|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
buttons stopped workingI did a cut & paste of some button controls on one of my forms and now
the button procedures don't get called when the buttons are pushed. Somehow dotnet has disassociated the buttons with their previous code. If I double-click the buttons in design mode, dotnet wants to create new click procedures for them with names appended with _1 (example: Private Sub ButtonQuit_Click_1) The question is, how do I make the button procedures match the control names again? The properties sheets on the controls still show them by their original names. If it matters, I pasted the controls onto the form after adding a tab control. Dotnet version is 2002 SP1 Thanks Dave Cullen wrote:
> I did a cut & paste of some button controls on one of my forms and now The "Handles" clauses get /dropped/ when you cut and paste controls > the button procedures don't get called when the buttons are pushed. around. It's just something the IDE does. You'll have to find each event handler in the code and add the Handles clauses again. Next time you feel the urge to move controls around like htis, add the Tab Control and Tab Page to the form, save it, close the Designer and open up the code Region that's marked "Do Not Change" .. and change it. Look for the lines of code that add each Control to the Form: Me.Controls.Add( Me.X ) If Me.X is one of the Controls that you want to move onto the Tab Page (called, say, Me.Tab1), change the above line to Me.Tab1.Controls.Add( X ) Save the Form, rebuild the project, cross your fingers and open the Designer. With a /bit/ of luck, your controls will have moved onto the tab page and will still have all their event handlers attached. HTH, Phill W.
Show quote
Hide quote
"Dave Cullen" <nospam@mail.com> wrote in message If you look at the "Handles" keyword after the event handler declaration, news:450FFE11.7CCE1680@mail.com... >I did a cut & paste of some button controls on one of my forms and now > the button procedures don't get called when the buttons are pushed. > Somehow dotnet has disassociated the buttons with their previous code. > > If I double-click the buttons in design mode, dotnet wants to create new > click procedures for them with names appended with _1 (example: Private > Sub ButtonQuit_Click_1) > > The question is, how do I make the button procedures match the control > names again? > > The properties sheets on the controls still show them by their original > names. If it matters, I pasted the controls onto the form after adding a > tab control. > > Dotnet version is 2002 SP1 > you will see that it is no longer associated with the control. Simply re-insert the "Handles myControl.abc" to make it work again. i.e.: Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load becomes......... Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As System.EventArgs) so, add the "Handles MyBase.Load" in this example. You guys rock. Thanks very much.
Robinson wrote: Show quoteHide quote > > "Dave Cullen" <nospam@mail.com> wrote in message > news:450FFE11.7CCE1680@mail.com... > >I did a cut & paste of some button controls on one of my forms and now > > the button procedures don't get called when the buttons are pushed. > > Somehow dotnet has disassociated the buttons with their previous code. > > > > If I double-click the buttons in design mode, dotnet wants to create new > > click procedures for them with names appended with _1 (example: Private > > Sub ButtonQuit_Click_1) > > > > The question is, how do I make the button procedures match the control > > names again? > > > > The properties sheets on the controls still show them by their original > > names. If it matters, I pasted the controls onto the form after adding a > > tab control. > > > > Dotnet version is 2002 SP1 > > > > If you look at the "Handles" keyword after the event handler declaration, > you will see that it is no longer associated with the control. Simply > re-insert the "Handles myControl.abc" to make it work again. > > i.e.: > > Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As > System.EventArgs) Handles MyBase.Load > > becomes......... > > Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As > System.EventArgs) > > so, add the "Handles MyBase.Load" in this example.
A Question on VB Classes
Forcing Checkbox to Return integer instead of boolean Controls of a form convert html string into a html document Create a Folder - Newbie Question different language windows Web.config issue Sorting a DataTable in a DataSet Reference to a non-shared member requires an object reference Reading logon/logoff datetime |
|||||||||||||||||||||||