CUBALIBRAS
Technical User
I am not new to programming but am new to Visual Studio and am having problems doing the most basic of things, and for two days I have search for the answer with no success.
Here's what I'm doing:
Visual Studio 2010 usual Visual C++
Windows Forms
I have designed my form and most things work well but I am having trouble with combobox. Here is my code:
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
comboBox1->Items->Add("Gold");
comboBox1->Items->Add("Silver");
comboBox1->Items->Add("Oil");
comboBox1->Items->Add("US $");
comboBox1->Items->Add("Euro");
comboBox1->Items->Add("British Pound");
comboBox1->Items->Add("Yen");
comboBox1->Items->Add("Australian $");
comboBox1->Items->Add("Canadian $");
comboBox1->Items->Add("Swiss Franc");
}
What I'm trying to achieve is when a user selects one of the options it then updates a label 'ticker' with the appropriate symbol, ie GLD for Gold, and I would like to do this in the 'ticker' object using a switch statement but not only can I not find the correct syntax but my combobox has no values in it, the program compiles with no errors so I am really confused.
I can display them using the 'Items / collections' tool in its properties but then I can't manipulate the data.
If anyone has a solution or a better method in which to achieve this pleas elet me know as I have no more hair to pull out !
Thank you,
Here's what I'm doing:
Visual Studio 2010 usual Visual C++
Windows Forms
I have designed my form and most things work well but I am having trouble with combobox. Here is my code:
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
comboBox1->Items->Add("Gold");
comboBox1->Items->Add("Silver");
comboBox1->Items->Add("Oil");
comboBox1->Items->Add("US $");
comboBox1->Items->Add("Euro");
comboBox1->Items->Add("British Pound");
comboBox1->Items->Add("Yen");
comboBox1->Items->Add("Australian $");
comboBox1->Items->Add("Canadian $");
comboBox1->Items->Add("Swiss Franc");
}
What I'm trying to achieve is when a user selects one of the options it then updates a label 'ticker' with the appropriate symbol, ie GLD for Gold, and I would like to do this in the 'ticker' object using a switch statement but not only can I not find the correct syntax but my combobox has no values in it, the program compiles with no errors so I am really confused.
I can display them using the 'Items / collections' tool in its properties but then I can't manipulate the data.
If anyone has a solution or a better method in which to achieve this pleas elet me know as I have no more hair to pull out !
Thank you,