Todd MacPherson
asked on
Trying to pass user created image.tag to another forms textbox
Hi
Using VB.Net VS 2003
I am just getting into public subs and how they work. I have some code where a user has created an image on the tab of a form - Form2. I am trying to put an event handler behind the image for when it is clicked so it will pass the Image.Tag value to a textbox on Form13.
Here is what I have thus far:
Dim tabAttImg As New PictureBox
tabAttImg.Image = clsGlobals.Form2.ImageList 1.Images(0 )
tabAttImg.Name = "pic" & txtName.Text
tabAttImg.Tag = txtName.Text
tabAttImg.Cursor = System.Windows.Forms.Curso rs.Hand
tabAttImg.Size = New Size(16, 16)
tabAttImg.Location = New Point(208, 8 + (TabbyCt * 24))
AddHandler tabAttImg.Click, AddressOf ListClickster(ByVal sender As System.Object, ByVal e As System.EventArgs) 'this line does not work the ByVal text is causing an error - says expression required
clsGlobals.Form2.TabContro l1.Selecte dTab.Contr ols.Add(ta bAttImg)
'this is the code I want put in a click event behind the image created above. How do I do this?
Public Sub ListClickster(ByVal ctrl As Control)
If clsGlobals.Form13 Is Nothing Then
clsGlobals.Form13 = New Form13
End If
clsGlobals.Form13.Show()
clsGlobals.Form13.Focus()
clsGlobals.Form13.lblTarge t.Text = "Target Attribute: " & ctrl.Tag
End Sub
Using VB.Net VS 2003
I am just getting into public subs and how they work. I have some code where a user has created an image on the tab of a form - Form2. I am trying to put an event handler behind the image for when it is clicked so it will pass the Image.Tag value to a textbox on Form13.
Here is what I have thus far:
Dim tabAttImg As New PictureBox
tabAttImg.Image = clsGlobals.Form2.ImageList
tabAttImg.Name = "pic" & txtName.Text
tabAttImg.Tag = txtName.Text
tabAttImg.Cursor = System.Windows.Forms.Curso
tabAttImg.Size = New Size(16, 16)
tabAttImg.Location = New Point(208, 8 + (TabbyCt * 24))
AddHandler tabAttImg.Click, AddressOf ListClickster(ByVal sender As System.Object, ByVal e As System.EventArgs) 'this line does not work the ByVal text is causing an error - says expression required
clsGlobals.Form2.TabContro
'this is the code I want put in a click event behind the image created above. How do I do this?
Public Sub ListClickster(ByVal ctrl As Control)
If clsGlobals.Form13 Is Nothing Then
clsGlobals.Form13 = New Form13
End If
clsGlobals.Form13.Show()
clsGlobals.Form13.Focus()
clsGlobals.Form13.lblTarge
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers