Button_Click change

  • Thread starter Thread starter Kenneth
  • Start date Start date
K

Kenneth

Hi,

I'm using VS.NET 2002 with code behind.

If I add a button to the design and don't change the id,
i.e. 'Button1' but activates and write some code to the
click event and then later change the 'Button1' id
to 'btnSave' or something in designview, then I've tried
to change the Sub Button1_Click to btnSave_Click, but this
doesn't seem to work.

What and in which sequence should I do to have the new
btnSave_click event get up and work?

TIA

/Kenneth
 
simple jus delete the code u have written for button1 's click event an then
go to design view and double click on the btnSave_Click button for the .vb
page to open where your cursor is in the on click event sub of tht button
...so can write ur click event code here
 
A method is associated with the events (like clicks, updates etc) in two
ways...

the first is as mentioned by Yusuf,... the initialise component you'll see
the button and the event, and the method linked to this event, change this.
the second is that the method has the Handles operator on the back of it,
something like:

Private Sub button1_Click (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles buttonOK.Click

It's either one or the other, I don't think it's both.

Hope that helps.
Dan.
 
In VS.Net, it is not necessary to make any change to the name of the Event
Handler, as the IDE will adjust the name of the control where it is
necessary. The name of the event handler is of no consequence, as long as it
references the correct name of the control for which it is designed.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.
 
Back
Top