The best thing to do is simply adopt the same coding strategey you had in VB
6.0. Name your controls before you add any code for their events and don't
"Anil Gupte" <anil-list@icinema.com> wrote in message
news:e2N%23icm9GHA.3396@TK2MSFTNGP04.phx.gbl...
> Interestingly, I found no Reference to button1 anywhere. I used the
> Reference in the right-click menu, then tried doing a find (told it to
> search the entire project). Also, more interesting, I found the
> following.
> this.btnTest.Click += new System.EventHandler(this.btnTest_Click_1);
>
> So, I double clicked on the button again, and it created:
> private void btnTest_Click_1(object sender, System.EventArgs e)
>
> This is nuts! The thing is totally munged. I don't want to have these
> weird names in there because no one will understand the code - if it
> becomes a real project more people will be on it. Someone, please shoot
> the person at Microsoft responsible for this! :-) Just kidding ok? But
> seriously, what is the way out of this mess?
>
> Thanx,
> --
> Anil Gupte
>
www.keeninc.net >
www.icinema.com >
> "Gino" <someone@microsoft.com> wrote in message
> news:%23MXP6Ei9GHA.4476@TK2MSFTNGP04.phx.gbl...
>> Right click on the method and then left click on Reference.
>> You will be taken to the Designer supplied code that
>> still has the original name.
>> Then you can edit the line so the names match.
>>
>> "Anil Gupte" <anil-list@icinema.com> wrote in message
>> news:eAvGzfe9GHA.3264@TK2MSFTNGP04.phx.gbl...
>>>I am learning to use C#, having decided to upgrade myself from VB.Net (to
>>>which I also recently upgraded a few months ago from VB6).
>>>
>>> I created a Windows Application and in it a form. I added a label and a
>>> button on the form. Then I double-clicked on the button and added the
>>> following:
>>> private void button1_Click(object sender, System.EventArgs e)
>>>
>>> {
>>>
>>> lblTest.Text="Hello World!";
>>>
>>> }
>>>
>>> As I usually do in VB, I changed the button name from button1 to btnTest
>>> in the Properties window. Now I have an error saying:
>>>
>>> C:\Projects\vbtut\WindowsApplication1\Form1.cs(74):
>>> 'WindowsApplication1.Form1' does not contain a definition for
>>> 'button1_Click'
>>>
>>> Why should it still be looking for button1, when I have gone in and
>>> changed it. In VB I don't have this problem, what gives?
>>>
>>> Thanx,
>>> --
>>> Anil Gupte
>>>
www.keeninc.net >>>
www.icinema.com >>>
>>>
>>
>>
>
>