[dba-VB] Setting a Textbox Variable

Michael Maddison michael at ddisolutions.com.au
Fri Jul 29 21:05:50 CDT 2011


Hi Don,

Your code seems to work as is.
Are you sure you have a textbox with that name?

Cheers

Michael M

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Saturday, 30 July 2011 3:39 AM
To: 'Discussion concerning Visual Basic and related programming issues.'
Subject: [dba-VB] Setting a Textbox Variable

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!


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11




More information about the dba-VB mailing list