disappearing code

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

Hi all,
I'm brand new at using Visual Studio, but I have basic
programming knowledge from C++.

I created a Windows form with some buttons, a tab area and
tabs, and some combo boxes with a list of values. I wanted
to set the default values for the combo boxes, so I found
the section in the code where all the attributes of the
combo boxes were defined. As the last line, I added
me.combobox1.selectedIndex = 0. I saved the changes and
then ran the form, and it worked (the first item was
showing in the combo box before I ever clicked it). Then I
made an unrelated change to the form, ran it again, and
the defaults were gone. I checked the code, and the code
was gone too. Why is it getting rid of my code????
 
Dont ya love wizards

Burn em in ell especially if u cant TURN THE BUGGERS OFF.
 
Visual Studio is very territorial. It definitely hates
when you modify anything within InitializeComponent, and
has a tendincy to delete anything it didn't generate at
random from said area. You'd be much better off putting
your inialization code within the Load event handler of
your form.

Hope it helps.

Travis Merkel
Murphy and Associates
 
Back
Top