473,388 Members | 1,326 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,388 software developers and data experts.

VB Visual Web Developer 05, Loop through TextBox Controls

PAHSTeacher
I have programmed recreationally in VBA for a few years.
I am making a simple website with Visual Web Developer 2005 (ASP.NET), using VB (for the first time).

I would like to loop through all of the text boxes on my simple webpage and concatenate the text value of each textbox into one string.

I can concatenate manually, e.g.

Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2.         s = ""
  3.         s = s & txb_001.text
  4.         s = s & txb_002.text
  5.         MsgBox(s)
However, I'd like to be able to loop through all textboxes on the web page without having to hardcode the name of each textbox.

I've managed to loop throught the controls on the web page, e.g.

Expand|Select|Wrap|Line Numbers
  1.  Dim s As String
  2.         Dim c As Control
  3.         s = ""
  4.         For Each c In Page.Form.Controls
  5.             s = s & c.ID
  6.         Next
  7.         MsgBox(s)

The problem is that there does not seem to be a text property for a generic control object, e.g. there is no

Expand|Select|Wrap|Line Numbers
  1. c.text

Ultimately I'd like to be able to loop through other controls such as drop down lists and list boxes.

This is so easy for me to do when I work with VBA for Excel, and yet I feel so helpless. Does anyone have some advice?
Jul 1 '07 #1
3 3498
shweta123
692 Expert 512MB
Hi,

Please refer this Link
Jul 2 '07 #2
kenobewan
4,871 Expert 4TB
Welcome to TSDN. One way would be to create a control array:
How to loop through multiple checkboxes
Jul 2 '07 #3
shweta123 and kenobewan,

Thank you for the links. That was exactly what I needed. You have a great site here and I appreciated the help.
Jul 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: VR | last post by:
Hi, I read about Master Pages in ASP.Net 2.0 and after implementing some WinForms Visual Inheritance I tryed it with WebForms (let's say .aspx pages, my MasterPage does not have a form tag itself...
4
by: sck10 | last post by:
I changed my aspx page to use a master page. The problem is that I can no longer loop through the controls on the content page. My question is how do you loop through the controls on the master...
1
by: Mark | last post by:
Hopefully somebody can help me with this very frustrating problem. In Dreamweaver I have a template page and a page created from this template called Home.aspx. In Visual Studio I have a class...
3
by: Deepson Thomas | last post by:
The below is error message : The type 'page2' already contains a definition for 'txtLocationName' i know why this comes. but iam not ablke to find the other place where the definition is added....
3
by: BJ | last post by:
I am trying to loop through the control collection of my ASP.NET web form in order to access the contents of each field. It seems as if there is a parent control (Literal?) in ASP.NET. Attached...
6
by: kberry | last post by:
I am clearing Textboxes on a form... this is loop I have came up with but was wondering if it can be shorter or not as long... Can anyone help? Dim controlOnForm As Control 'Places a control...
6
by: Svein Erik | last post by:
C# asp.net 2.0. I'm creating an online survey. I'm making a string array that's holding the variables of the answers made in the radiobuttonlists that i create manually. I need to make a method...
3
by: Shawn | last post by:
I'm trying to go through a large number of logically named textboxes using a loop and cannot figure out how short of explicitly referencing every single one.
10
by: Derek Hart | last post by:
I am going in circles trying to loop through properties on 3rd party controls. For example, I have a textbox that has its maximum length located at MyTextBox.Properties.MaxLength - instead of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.