Results 1 to 3 of 3

Thread: [2008] Friend WithEvents

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    470

    [2008] Friend WithEvents

    Hello,

    If I drag a button to the form, when the user clicks the button to fire an event.

    The code looks like

    Code:
    Private Sub button1_Click(ByVal sender As System.Object,_
        ByVal e As System.EventArgs) Handles button1.Click
        text1.Text = "Hello World!"
    End Sub
    It's very short and simple.
    My question is shall I define the button as

    Code:
    Friend WithEvents button1 As Button
    I haven't defined it but it works well.

    I saw some books define it.
    Is it unnecessary?

    Thanks for your time.
    Last edited by zhshqzyc; Jan 6th, 2009 at 05:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width