-
April 27th, 2017, 02:04 PM
#1
[RESOLVED] Problem with Visual C++
Hello.
I'm writing some program, and I stuck on default ComboBox value.
In my Form application my form.h [project] is generating code automatically. But in property box there is no "SelectedIndex" or "SelectedItem" or "SelectedText".
This is my code:
Code:
//
// GUI_Combo_Swiat
//
this->GUI_Combo_Swiat->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->GUI_Combo_Swiat->FormattingEnabled = true;
this->GUI_Combo_Swiat->Items->AddRange( gcnew cli::array< System::Object^ >( 4 )
{
L"- Wybierz Świat -", L"Świat 1", L"Świat 2",
L"Świat 110"
} );
this->GUI_Combo_Swiat->Location = System::Drawing::Point( 458, 98 );
this->GUI_Combo_Swiat->MaxDropDownItems = 20;
this->GUI_Combo_Swiat->Name = L"GUI_Combo_Swiat";
this->GUI_Combo_Swiat->Size = System::Drawing::Size( 121, 21 );
this->GUI_Combo_Swiat->TabIndex = 0;
When I'm writing manualy this kind of code:
Code:
this->GUI_Combo_Swiat->SelectedIndex = 0;
It works until I won't make some changes in ANY control. After that IDE is automatically removing my line of code, and combobox is starting empty again...
Could you please help me?
Greetings, genotypek.
Last edited by Genotypek; April 27th, 2017 at 02:27 PM.
-
April 27th, 2017, 02:20 PM
#2
Re: Problem with Visual C++
The thread was moved from Visual C++ forum because the posted code is no a native C++.
Victor Nijegorodov
-
April 28th, 2017, 03:07 AM
#3
Re: Problem with Visual C++
Don't ever apply any manual changes to the code inside InitializeComponent()! Your changes being overwritten by Forms Designer is just the most harmless result you can get. You may also completely mess up the designer.
Instead, put initialization code like this into your form's constructor, after the call to InitializeComponent().
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
April 28th, 2017, 03:29 PM
#4
Re: Problem with Visual C++
Thanks a lot!
That works! ☺
I didn't even know, that the kind of code where I can write my code manually even exists.
Thanks for help, problem solved.
Greetings, genotypek.
-
April 28th, 2017, 05:56 PM
#5
Re: Problem with Visual C++
You're welcome.
This may be the time to mark this thread [RESOLVED] using the Thread Tools menu at the top. This is a signal to other users that there's a solution in here.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|