PC Review


Reply
Thread Tools Rate Thread

Control Arrays Question

 
 
Diarmuid
Guest
Posts: n/a
 
      8th Aug 2005
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


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      8th Aug 2005
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



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      9th Aug 2005
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


 
Reply With Quote
 
Diarmuid
Guest
Posts: n/a
 
      9th Aug 2005
Ok, I get what you mean. I can just check for more specific label if needs
be.
Thanks
Diarmuid

"Cor Ligthert [MVP]" <(E-Mail Removed)> wrote in message
news:%23h9G$(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
prajesh.shreshta@gmail.com
Guest
Posts: n/a
 
      6th Sep 2005
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

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      6th Sep 2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control arrays =?Utf-8?B?Sm9zZXBo?= Microsoft C# .NET 1 6th Jun 2007 02:39 AM
Control Arrays T3rM1ght Microsoft VB .NET 3 16th Oct 2005 12:08 PM
Control Arrays Charles Watson Microsoft Excel Programming 2 14th Nov 2004 01:52 PM
Control Arrays =?Utf-8?B?a3JvbGxlbmhhZ2Vu?= Microsoft VB .NET 3 7th Sep 2004 11:46 AM
Control array of control arrays? =?Utf-8?B?RnJlZXp5?= Microsoft C# .NET 0 1st Mar 2004 03:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:28 AM.