0

i'm using 4 pictureboxes and 1 textbox in one particular application. when i click on picturebox1 i need a certain value to be fed as input to the textbox, simillarly for the other pictureboxes too. how can it be done ?

4
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by Gé48
0

Hello,

Let me see if i got this right, you want to use the pictureboxes as textboxes, and then pass the value from one of the pictureboxes to the textbox?

0

When the picturebox is loaded with a picture you could put a string into the Tag property. When you click on the picturebox you can copy the Tag value to the TextBox.

0

This will do the trick.

Private Sub PictureBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick, PictureBox2.MouseClick, PictureBox3.MouseClick, PictureBox4.MouseClick
        Dim strName As String = ""
        Dim text As PictureBox = sender
        strName = text.Name
        If strName = "PictureBox1" Then
            TextBox1.Text = "10" 'value you want
        End If
        If strName = "PictureBox2" Then
            TextBox1.Text = "20" 'value you want
        End If
        If strName = "PictureBox3" Then
            TextBox1.Text = "30" 'value you want
        End If
        If strName = "PictureBox4" Then
            TextBox1.Text = "40" 'value you want
        End If
    End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.