I using dynamic method to create button,textbox and picture contorls in Panel1(vb.net),
how could I click the one row of picture and can trigger the textbox event in the same row?
if i click paste(2) then it can judge I click (2) and affect txt(2) to show message
how 'show_to_txt' function write?
[img=http://www1.picturepush.com/photo/a/10406824/640/10406824.jpg]

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer = 0
For i = 1 To 3
Dim txt As New TextBox
txt.Name = "txt" & i.ToString
txt.Location = New Point(10, i * 50 + 3)
Panel1.Controls.Add(txt)
Dim pic As New PictureBox
pic.Name = "paste" & i.ToString
pic.Image = Picture1.Image ' show image
pic.Height = 15
pic.Location = New Point(150, i * 50 + 3)
Panel1.Controls.Add(pic)
AddHandler pic.Click, AddressOf show_to_txt
Next
End Sub
Private Sub show_to_txt(ByVal sender As Object, ByVal e As EventArgs)
'MsgBox("you click: " & CType(sender, PictureBox).Name)
'if i click paste(2) and it can judge I click (2) and affect txt(2) to show message
'I wnat to implement this action:
'txt1.text = "you click: 1"
'txt2.text = "you click: 2"
'txt3.text = "you click: 3"
End Sub
End Class
How do I call the handler to implement this code?
Thanks.

New Topic/Question
Reply



MultiQuote





|