Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Sat Jul 30 05:24:47 CDT 2011
Yes, Don, your code should work as is - there are several other options
(VS2010):
Dim txt As TextBox
txt = Me.Controls("TextBox1")
or
txt = Me.Controls.Item("TextBox1")
or
txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox)
...
Thank you.
--
Shamil
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison
Sent: 30 ???? 2011 ?. 6:06
To: df.waters at comcast.net; Discussion concerning Visual Basic and related
programming issues.
Subject: Re: [dba-VB] Setting a Textbox Variable
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
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com