July 24th, 2007, 14:23 PM
C# ComboBox Question
Hello every one I知 in need of some programming advice. I want to use a comboBox in one of my GUI痴 application. The point of the box is to trigger an image to appear inside of a picture box. I know how to build my collections list but I知 at a lost on how I should write the event handler within the combox .
Here is an example of the code I知 trying
public void SelectText( string text )
// Find the index of the specified string.
int index = comboBox.FindString( text );
// When the string was not found; add it.
if( index == -1 )
index = comboBox.Items.Add( text );
// Select the string item.
comboBox.SelectedIndex = index;
How do I re-write this to trigger a image and sound from the comboBox to the pictureBox.
July 27th, 2007, 04:56 AM
Well I don’t know how to do this using a comboBox but I now know how to accomplish the same thing using a buttons. For anyone who is interested this is an example of how I coded the button to link to a pictureBox.
private void uiTheif_Click(object sender, EventArgs e)
pictureBox1.Image = new Bitmap(Character.Properties.Resources.Rogue);
MessageBox.Show("Error creating image!");
August 1st, 2007, 02:34 AM
Did u work it out?
Surely you could add the pictureBox1 snippet to your code in the first post?
The trick with Apps is that everything is an object that can be referenced/accessed from most parts of the code. Most GUI elements are globally defined, so it's easier to write.
Any good screenshots of your apps?
--- 0wN3D by 3gG ---