Hello again.
Quick Question:
I have a series of labels on my asp.net c# page: lbl128d, lbl64d,
lbl32d, lbl16d, lbl8d, lbl4d, lbl2d, lbl1d
I would like to place these in an array so that I can loop through them
to assign values to them.
I have the controls places on my page and I create an array like this
in page_load:
fourthLabels = new Label[8] {lbl128d, lbl64d, lbl32d, lbl16d, lbl8d,
lbl4d, lbl2d, lbl1d};
When I try to loop through them, it says I'm dealing with a null
reference exception....
I'm guessing that I have the array in the wrong place (page_load vs
somewhere else) and the controls don't exists when I create the
array.....
Can this be done? If so can you point me in a direction that will lead
to a solution?
Thanks much. I learn so much from this newsgroup.
-Guy 2 1354
Yes, it can be done, and that's how you do it.
How do you loop through the array, and what do you do with the labels?
Guy Noir wrote:
Hello again.
Quick Question:
I have a series of labels on my asp.net c# page: lbl128d, lbl64d,
lbl32d, lbl16d, lbl8d, lbl4d, lbl2d, lbl1d
I would like to place these in an array so that I can loop through them
to assign values to them.
I have the controls places on my page and I create an array like this
in page_load:
fourthLabels = new Label[8] {lbl128d, lbl64d, lbl32d, lbl16d, lbl8d,
lbl4d, lbl2d, lbl1d};
When I try to loop through them, it says I'm dealing with a null
reference exception....
I'm guessing that I have the array in the wrong place (page_load vs
somewhere else) and the controls don't exists when I create the
array.....
Can this be done? If so can you point me in a direction that will lead
to a solution?
Thanks much. I learn so much from this newsgroup.
-Guy
Göran Andersson wrote:
Yes, it can be done, and that's how you do it.
How do you loop through the array, and what do you do with the labels?
Nevermind. I had a stupid PEBKAC error. I was calling the loop before I
created the array *DOH*
It works now.
Thanks much for the response. Just had a logic lapse here for a
minute.....
-Guy
Guy Noir wrote:
Hello again.
Quick Question:
I have a series of labels on my asp.net c# page: lbl128d, lbl64d,
lbl32d, lbl16d, lbl8d, lbl4d, lbl2d, lbl1d
I would like to place these in an array so that I can loop through them
to assign values to them.
I have the controls places on my page and I create an array like this
in page_load:
fourthLabels = new Label[8] {lbl128d, lbl64d, lbl32d, lbl16d, lbl8d,
lbl4d, lbl2d, lbl1d};
When I try to loop through them, it says I'm dealing with a null
reference exception....
I'm guessing that I have the array in the wrong place (page_load vs
somewhere else) and the controls don't exists when I create the
array.....
Can this be done? If so can you point me in a direction that will lead
to a solution?
Thanks much. I learn so much from this newsgroup.
-Guy
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adonai |
last post by:
Hi, I'm having an issue with this code that I'm writing, I'm curious as
to why the windows form label (lblTime) isn't getting updated with the
new variable when I use the timer. I made a blank form...
|
by: jhs |
last post by:
Hello,
I developping a .NET windows form application an need some help to create an
array of System.Windows.Forms.Label in order to be able to manage all of
them using index.
I'm trying to do...
|
by: Joe |
last post by:
I know that the Literal control will not render a <span> tag so I can not
format its text. Other than this, what is the difference betwen the Literal
control and the LiteralControl Control? How...
|
by: Lighting_dragon |
last post by:
I try to make an array of label as this.
Dim ArrLabel(10) as System.Windows.Forms.Label
For i =0 to 10
ArrLabel(i) = New System.Windows.Forms.Label
ArrLabel(i).Left=25
ArrLabel(i).Top=25*i...
|
by: jcrouse |
last post by:
Is there a quick and easy way to change the color of a label controls border
from the default black to white?
Thank you,
John
|
by: anthony |
last post by:
I know this is probably talk about millions of time here, but I cant seem
to find a close one, I am so used to the vb6 control array, now that I have
to use vb.net for my project, I like to do...
|
by: Neil Wallace |
last post by:
Hi,
This is an odd one. I've been struggling to get "double click" to work well
for my controls.
The same event handler works perfectly for buttons, but not for labels.
Can anyone tell me...
|
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...
|
by: karthik25 |
last post by:
Hi,
The following code creates a tab container, 5 tab panels, buttons, labels. I was able to add event handlers to the button. But how am i supposed to access the dynamically created labels? For...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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...
| |