Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disappearing objects...code to follow

Status
Not open for further replies.

mbutch

Programmer
Nov 17, 2000
100
US
I created a new c# win app project in vs.net on winxp.

I added a basic combo box to my form using the toolbox.

In the code editor I create an array that contains a list of subdirectories in the form1 method and call the initialize method:
InitializeComponent(myArray);.

Now I know the generated comments say not to edit the Initialize method, but I added an arguement to it as such:
private void InitializeComponent(string[] comboList)

To my combobox I added:
this.combobox1.Items.AddRange(comboList);

Now when I go back to the design view, the combobox disappears, but the code remains. I complie it and the combobox shows up fine with the desired list of items. Back in the designer I add a text box to the form using the toolbox. When I switch to the code editor, my combobox code has disappeared and when compiled, no more combobox.

Any ideas?

Thanks
 
Uhhh, don't do that, because the designer will overwrite your changes.
;-)

Chip H.
 
Make a new method and put it in page load is what I would do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top