473,804 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing a label collection problem

Hey guys,
It appears to be a very simple problem, but I just cannot realize why
it is happening.
I have a HTMLTable in which I put 10 labels. Now, I'm trying to parse
the collection and to put text on labels.
Here is my code :
Dim ctrlLbl As Control
For Each ctrlLbl In Me.Controls
If (TypeOf (ctrlLbl) Is UI.WebControls. Label) Then
CType(ctrlLbl, Label).Text = "something"
k += 1
End If
Next
The problem is that there are no labels in the ControlCollecti on thus
there are 10 in the table on the page.
I tried to parse the table collection but with the same result.
Can anybody explain me what is happening there?
Thank you in advance

Feb 3 '06 #1
2 1068
I ran into this problem sometime back...it's pretty straightforward .
The issue is that the label controls are child controls of the table
control. In other words, Me.Controls would have a table control, and
the table would have the label controls. I got around this issue in
this issue by creating a function that accepted a control and called
itself recursively if the control had child controls. If the control
was of a certain type, I set various properties. At the end of the sub
it checked to see if there were child controls and, if so, call itself
passing the child control. It would look something like this...

function SetTheText(Page as Control)
Dim ctrlMe as control
for each ctrlMe in page
if typeof(ctrlMe) is label then
ctype(ctrlMe).t ext = "something"
end if
if ctlcontrol.cont rols.count > 0 then
SetTheText(ctrl me) 'this recursive call will dig into
your table's controls
end if
next
end function

It's been a while since I worked through this, but you should be able
to follow the example above and make some progress.

Feb 3 '06 #2
Thanks a lot... It's a great idea making a recursive function for it.
I'm now developing a little bit for the case I need.
Thanks again

Feb 3 '06 #3

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

Similar topics

0
1477
by: milesd | last post by:
Hi, Rather new to MSXML4. I am parsing an XML data-stream over HTTP, and would like to know why I cannot parse XML nodes with multiple parameters. The XML and Code are below, BUT I would like to know how to parse individual XML nodes when tags are specified as "<FIELD NAME="collection">myVal........". The code below gives me "FIELD" as the value of the XML, not myVal.
2
14408
by: knoak | last post by:
Hi there, In my form, after validation, labels of wrong fields are turned into a red color. What i want now is when you hit 'reset', to make all the labels grey again. I have the next code: ====================================== function GrayLabels()
2
7778
by: Rashida | last post by:
Hi all! I have written a function to fetch lebels from xml file for cross-language interoperability. Please refer function code below. I am invoking itfrom my asp page saying <%=getValueForLabelNode(strLanguage,"English").toString()%> It gives me an error 'Microsoft JScript runtime (0x800A138F) 'undefined' is null or not an object'
4
2865
by: Mark | last post by:
How do you reference the caption of the label attached to a control on a form by first referencing the form? For example, textbox named Addr1 has an attached label with the caption "Address1". What is the expression to get a Msgbox to display "Address1" ? Something like: MsgBox Me!Addr1.AttachedLabel.Caption
1
7990
by: Craig | last post by:
How do I programmatically change the text property of a label in an ItemTemplate in a datagrid? Specifically the Text property. I want to change the databinding to another column at runtime. <asp:TemplateColumn HeaderText="Rate1"> <ItemTemplate> <asp:Label runat="server" Text='<%# fRate(DataBinder.Eval(Container, "DataItem.RateAgentID")) %>' ID="Label3" NAME="Label3"> </asp:Label>
1
2466
by: Christoph Bisping | last post by:
Hello! Maybe someone is able to give me a little hint on this: I've written a vb.net app which is mainly an interpreter for specialized CAD/CAM files. These files mainly contain simple movement and drawing instructions like "move to's" and "change color's" optionally followed by one or more numeric (int or float) arguments. My problem is that the parsing algorithm I've currently implemented is extremely slow.
0
2388
by: bruce | last post by:
hi... it appears that i'm running into a possible problem with mechanize/browser/python rgarding the "select_form" method. i've tried the following and get the error listed: br.select_form(nr = 1) br.select_form(name="foo") br.select_form(name=foo) br.select_form(name="foo")
4
6845
by: Neil.Smith | last post by:
I can't seem to find any references to this, but here goes: In there anyway to parse an html/aspx file within an asp.net application to gather a collection of controls in the file. For instance what I'm trying to do is upload a html file onto the web server, convert it to aspx file and then parse it for input tags/controls, which in turn will become fields in a newly created database table. Clearly when the aspx file is called the...
12
13281
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the same Tag number. (I thought it might help) The checkboxes name is a concatenation of "chkCancel" and a number that represents the order in which they were created: chkCancel0 (Tag = 0) chkCancel1 (Tag = 1)
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.