[dba-VB] Setting a Textbox Variable

Dan Waters df.waters at comcast.net
Fri Jul 29 12:38:32 CDT 2011


In VB.Net, I'm trying to pass a listbox object into a procedure, get part of
the name of that listbox, and then set a textbox object to a specific
textbox using the partial name of the listbox.  In Access it's easy:

    Public Sub XXX(lst As ListBox)

        Dim txt As TextBox
        Dim stg as String

        stg = "txt" & Mid(lst.Name, 4)
    
        Set txt = Me.Controls(stg)
    
    End Sub

Part of the answer is:

    stg = "txt" & lst.Name.Substring(0, 4)


But I don't know how to actually 'set' the textbox variable to a specific
textbox.

Thanks!





More information about the dba-VB mailing list