Button problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gary Paris

    #1

    Button problem

    On my windowsform, I have a tab control. On the control, I have as button
    called btnSave. I wanted to move the button off the tab control and onto
    the windowsform. Shouldn't be a problem I thought. When I highlighted the
    button, I did a CTRL-X then a CTRL-V to paste the button on the form.

    Now the click event doesn't work. The button still has the same name, but
    when I double click on the button, the method that is created is called
    btnSave_Click_1 . It seems that the button has been renamed, but when I
    look at the properties, the name still says btnSave.

    Anybody know what is going on?

    Thanks,

    Gary


  • Rlrcstr

    #2
    Re: Button problem

    There is as designed. What's happening is that you still have the old event
    handler, but when you cut and pasted the control, VS disassociated it with
    the button. (i.e. it no longer says Handles btnSave.Click after it.)

    When you double click, VS is adding the _1 because there is already a sub
    called btnSave_Click and it wants to create an event handler. Since the
    name of the handler doesn't really matter, it just tacks on the _1 and
    specifies that it Handles btnSave.Click.

    To "fix" this, just add the "Handles" code back to the original sub routine
    and delete the _1 stuff.

    Jerry



    "Gary Paris" <yada@somewhere .com> wrote in message
    news:%23QiBvNWY FHA.1404@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > On my windowsform, I have a tab control. On the control, I have as button
    > called btnSave. I wanted to move the button off the tab control and onto
    > the windowsform. Shouldn't be a problem I thought. When I highlighted
    > the button, I did a CTRL-X then a CTRL-V to paste the button on the form.
    >
    > Now the click event doesn't work. The button still has the same name, but
    > when I double click on the button, the method that is created is called
    > btnSave_Click_1 . It seems that the button has been renamed, but when I
    > look at the properties, the name still says btnSave.
    >
    > Anybody know what is going on?
    >
    > Thanks,
    >
    > Gary
    >
    >[/color]


    Comment

    Working...