Results 1 to 3 of 3

Thread: Problem with Events

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    2

    Problem with Events

    I'm trying to create an HyperLink in a Table and give it an argument so when I'll click it, it will call the CommandBtn_Click.
    My problem is that it does'nt call the CommandBtn_Click when i click the HyperLink.
    What have I done wrong?

    This is my code:

    VB Code:
    1. Private Sub CommandBtn_Click(ByVal sender As Object, ByVal e As CommandEventArgs)
    2.         Label1.Text = "You Clicked " & e.CommandArgument
    3. End Sub
    4.  
    5. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    6.         Dim tRow As New TableRow
    7.         Dim tCell As New TableCell
    8.         Dim tLnkBtn As New LinkButton
    9.         tLnkBtn.Text = "TestLink1"
    10.         tLnkBtn.CommandArgument = "Link1"
    11.         AddHandler tLnkBtn.Command, AddressOf CommandBtn_Click
    12.         tCell.Controls.Add(tLnkBtn)
    13.         tRow.Cells.Add(tCell)
    14.         DeptTbl.Rows.Add(tRow)
    15. End Sub

  2. #2
    Lively Member TLord's Avatar
    Join Date
    Jun 2004
    Posts
    95
    Have you tried using a delegate to solve this problem?
    Do you think my life is easy?
    Do you think it's good to win?
    do you think it's nice to kill?
    Do you think learning is a must?
    Do you think computers are nothing?
    Do you think this post is stupid?
    Do ypu think we're really humen?

    DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    2

    no..

    I don't know how to..
    can you please show me how/where to use the delegate?

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