TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
david green
NA
3
0
problem need help
Apr 26 2009 10:12 AM
this is code to make a program that when the name of an animal is spoken into a mic a picture of that animal is displayed that is the function i am having bother with here is the code it is the switch statement i am having bother with if you could replace the ? also any other suggestions would be helpfull
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
namespace SimpleSpeechRecognition
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
speechListBox1.Items.Add("dog");
speechListBox1.Items.Add("cat");
speechListBox1.Items.Add("hamster");
speechListBox1.Items.Add("elephant");
speechListBox1.Items.Add("lion");
speechListBox1.Items.Add("tiger");
speechListBox1.SpeechEnabled = true;
}
private void speechListBox1_SelectedIndexChanged(obje... sender, EventArgs e)
{
MessageBox.Show(speechListBox1.SelectedI...
SayPhrase(speechListBox1.SelectedItems[0...
}
private void SayPhrase(string PhraseToSay )
{
SpeechVoiceSpeakFlags SpFlags = new SpeechVoiceSpeakFlags();
SpVoice Voice = new SpVoice();
Voice.Speak(PhraseToSay, SpFlags);
}
private void pictureBox1_click(object sender, EventArgs e)
{
switch (?)
{
case "cat":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\cat.jpg");
pictureBox1.Refresh();
}
case "dog":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\dog.jpg");
pictureBox1.Refresh();
}
case "hamster":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\hamster.jpg");
pictureBox1.Refresh();
}
case "elephant":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\elephant.jpg");
pictureBox1.Refresh();
}
case "lion":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\lion.jpg");
pictureBox1.Refresh();
}
case "tiger":
{
pictureBox1.Image = Image.FromFile(@"C:\Documents and Settings\Administrator\My Documents\My Pictures\pictures\tiger.jpg");
pictureBox1.Refresh();
}
}
}
}
}
Reply
Answers (
1
)
Small question regarding Lists
Exporting Grid/dataset to excel