473,394 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

dynamic controlname txttest+i.text

Hi,

I want to change the text of a textbox with a loop like this:
For t = 0 To
txtTest1.text="hello"
txtTest2.text="hello2"
next t

but I want to use the controlname dynamically eg
txtTest+i.text

But wat is the correct syntax for this??

Thanks.

Nov 21 '05 #1
3 941
Hi Henk,

Maybe you could loop through the forms controls collection and test each for
your control name and if true then set the text:

Dim cnl As Control

Dim t As Integer

For Each cnl In Me.Controls

For t = 0 To 2

If cnl.Name = "Text" & t Then

cnl.Text = "Hello" & t

End If

Next

Next
"henk" <ri*******@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,

I want to change the text of a textbox with a loop like this:
For t = 0 To
txtTest1.text="hello"
txtTest2.text="hello2"
next t

but I want to use the controlname dynamically eg
txtTest+i.text

But wat is the correct syntax for this??

Thanks.

Nov 21 '05 #2
"henk" <ri*******@hotmail.com> schrieb:
I want to change the text of a textbox with a loop like this:
For t = 0 To
txtTest1.text="hello"
txtTest2.text="hello2"
next t

but I want to use the controlname dynamically eg
txtTest+i.text


Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #3
Henk,

If you start new with this take than the Tag property, that you can as well
use with menuitems.

For the rest see one of the samples from Herfried I am sure that there is
one that will fit you.

I hope this helps,

Cor
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
If we use GET protocol, we can use either Request("controlname") or Request.QueryString("controlname") to get the data entered by the user. But if we use POST protocol, we MUST use...
1
by: Terry | last post by:
I've tried and tried, and thought I had it figured out, but still the results indicate that I'm wrong. Help is appreciated. I'm merely trying to grab a value from a form and insert it into a...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: Shamin | last post by:
Hi All, I'm refering to the code in this article. http://www.dnzone.com/ShowDetail.asp?NewsId=151 I'm trying to do the same in VB.NET and I'm having problems with procedure...
4
by: Paul W | last post by:
i have some dynamic controls that i add to a webform (actually, i dynamiclly build a table and add the controls to cells). some of these controls are HtmlSelect controls with the multiple property...
1
by: Robert Ward | last post by:
I am trying to load a web user control from code behind. This used to be something simple in .net 1.1 Dim myControl As ControlName = CType(Page.LoadControl("ControlName .ascx"), ControlName ) ...
4
by: mros | last post by:
I've created three buttons on a form (IsMdiContainer=True), it's mdi parent. I need to disable these buttons from one of my child form. So, I've changed these buttons modifier to Friend Shared...
0
by: Michael | last post by:
Hi All, I have a general question. I'm in the process of designing a app that will allow user to enter data for Medical forms and print the corresponding word doc. I have about 100 forms I have to...
0
by: Terry | last post by:
Hello, I have problem adding controls to my webpage default.aspx. There is a group of controls that just refuse to be used with message: 'The name 'controlname' does not exist in the current...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.