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

Control Arrays Question

Are there control arrays in vb.net 2005?
Maybe some one could help me out with an example. I know how to this in VB6.
My database is called Planner.mdb
There is a table called Weekdays.
I want to read the first record in, and use that to set my labels as follows
me.lblDay1 = WeekDays!Day1
me.lblDay2 = WeekDays!Day2

and so on. In VB6 I would have done this in a for loop. Something like
me.lblDays(iLoop_ = rsWeekdays("Day" & iLoop)

How would I do that using the new datasets?

Thanks
Diarmuid
Nov 21 '05 #1
5 1342
Diarmuid wrote:
Are there control arrays in vb.net 2005?
Maybe some one could help me out with an example. I know how to this in VB6.
My database is called Planner.mdb
There is a table called Weekdays.
I want to read the first record in, and use that to set my labels as follows
me.lblDay1 = WeekDays!Day1
me.lblDay2 = WeekDays!Day2

and so on. In VB6 I would have done this in a for loop. Something like
me.lblDays(iLoop_ = rsWeekdays("Day" & iLoop)

How would I do that using the new datasets?

Thanks
Diarmuid


Either make your own array:
dim Controls(X) as Controls
Controls(0) = lblDay1

or use the form's control array:
Me.Controls

if you use the form's control array you have to check if it is a
textbox/labelbox or not before using it, since it has all the controls
in it.

Chris

Nov 21 '05 #2
Diarmuid,

This is an often spread misunderstanding given by VB6 people.

VB classic had arrays from controls on a form
VBNet (starting direct with version 2002) has an array for every control
including the Form which is a control.

Therefore and let us say that you put your labels direct on the form, you
can do something as beneath roughly typed in this message

\\\
For each ctr in me.controls
If Typeoff ctr Is Label then
ctr.Text = ds.Tables("Whatever").Rows(0).Item(ctr.tag.ToStrin g)
End if
Next
///
(You have set the datatable columnames than in the tags)

Be aware that I wrote every control has its array of controls and therefore
if the labels are by instance on a panel you have to do mypanel.controls

I hope this helps,

Copr

I hope this helps,

Cor
Nov 21 '05 #3
Ok, I get what you mean. I can just check for more specific label if needs
be.
Thanks
Diarmuid

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Diarmuid,

This is an often spread misunderstanding given by VB6 people.

VB classic had arrays from controls on a form
VBNet (starting direct with version 2002) has an array for every control
including the Form which is a control.

Therefore and let us say that you put your labels direct on the form, you
can do something as beneath roughly typed in this message

\\\
For each ctr in me.controls
If Typeoff ctr Is Label then
ctr.Text = ds.Tables("Whatever").Rows(0).Item(ctr.tag.ToStrin g)
End if
Next
///
(You have set the datatable columnames than in the tags)

Be aware that I wrote every control has its array of controls and
therefore if the labels are by instance on a panel you have to do
mypanel.controls

I hope this helps,

Copr

I hope this helps,

Cor

Nov 21 '05 #4
hi
thanx ,yes it did help me.but now the huge problem is how to save Image
in sql. i tried be creating a table with the column with data type
"image" but it didnt work.but friend of mine told me that i can use
"blob" data type but in sql there is no such data type named "blob"
so if you can help me to keep image in data base sql

Nov 21 '05 #5
Pajesh,

The datatype image and blob are the same.

We have many samples of how to use Images in Adonet on our website, have
just a search for that on our website.

http://www.windowsformsdatagridhelp.com/default.aspx

I hope this helps,

Cor
Nov 21 '05 #6

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

Similar topics

3
by: Mani | last post by:
Hi, can anyone help me on how to create a control array in C++ builder like we create in VB. I have another question regarding controls. I want to clear a group of text boxes in the form on a...
9
by: Jay | last post by:
Why is it publisized that VB.NET does not support control arrays? This is not true. It is just that it is implemented in another way. Dim txtNumbers(10) as TextBox Everything must be done...
8
by: Greg | last post by:
In VB6 I made heavy use of control arrays I see they have been 'deprecated' in vb.Net, with a questionable explanation that they are no longer necessary which just addresses the event issue!...
3
by: T3rM1ght | last post by:
Hello there, I have a question concerning the final release of VB.NET, will there be inherent support for creating control arrays as in VB6? I am have a problem with code for a multi-user server...
9
by: Michael D. Ober | last post by:
In VB 6, you can create control arrays for your option groups and scan with the following code dim opt as OptionButton for each opt in OptionGroup ' Do something next opt I know VB 2005...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
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: 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
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
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,...

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.