Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Control Arrays Question

15 views
Skip to first unread message

Diarmuid

unread,
Aug 8, 2005, 4:53:56 PM8/8/05
to
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


Chris

unread,
Aug 8, 2005, 5:32:01 PM8/8/05
to

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

Cor Ligthert [MVP]

unread,
Aug 9, 2005, 1:45:40 AM8/9/05
to
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.ToString)
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


Diarmuid

unread,
Aug 9, 2005, 5:11:24 AM8/9/05
to
Ok, I get what you mean. I can just check for more specific label if needs
be.
Thanks
Diarmuid

"Cor Ligthert [MVP]" <notmyfi...@planet.nl> wrote in message
news:%23h9G$WKnFH...@TK2MSFTNGP15.phx.gbl...

prajesh....@gmail.com

unread,
Sep 5, 2005, 11:36:27 PM9/5/05
to
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

Cor Ligthert [MVP]

unread,
Sep 6, 2005, 12:59:26 AM9/6/05
to
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

0 new messages