2
Answers

Skip the same code for buttons [RESOLVED]

Antonio March

Antonio March

14y
3.2k
1
I have several Windows Forms in my VB .NET application.
Most of them have a button called btnExit that has this event.

Public Class frmTest
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles btnExit.Click

        Me.Close()

    End Sub
End Class

I think this piece of code could removed from all the forms and substitute by a code that reflects the following way of reasoning

btnExit belongs to the Class of clsButtonsExit, and that class always handles the Me.Close () statement when clicked.... But, how is this implemented???

Another question: the underscore in the function declaration can't be removed in Visual Basic 2010 Express, it causes a Debug error. I thought underscores where no longer required in VB 2010 (althought I think it is a good practise to keep them )

thanks
Answers (2)
0
Sanjeeb Lenka
NA 22.1k 1.3m 11y
hi,

you have to set the startup object. for set the start up object follow this step.

open solution explorer. select the solution or right click on solution and click on properties.


in property window set the startup object as your class name.

follow the screen.




2nd