Re: Using Variables inplace of Textbox Title
Posted: 5/9/2006 7:18:32 PM
By: Comfortably Anonymous
Times Read: 1,470
0 Dislikes: 0
Topic: Programming: .NET Framework
Parent Message
Here, try this (Maybe not the best implementation, threw this together quick). The trick is the 'Find' method.

To get this example to work, create a new VB Windows Form app and drag two labels (Label1 and Label2) onto it, then a button called Button1.

Let me know if you have any questions.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim lbl As Label = Me.Controls.Find("Label1", True)(0)
        lbl.Text = "Found #1"

        Dim lbl2 As Label = Me.Controls.Find("Label2", True)(0)
        lbl2.Text = "Found #2"
    End Sub
End Class
Rating: (You must be logged in to vote)