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(iLoo p_ = rsWeekdays("Day " & iLoop)
How would I do that using the new datasets?
Thanks
Diarmuid 5 1372
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(iLoo p_ = 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
Diarmuid,
This is an often spread misunderstandin g 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("What ever").Rows(0). Item(ctr.tag.To String)
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.control s
I hope this helps,
Copr
I hope this helps,
Cor
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******** ********@TK2MSF TNGP15.phx.gbl. .. Diarmuid,
This is an often spread misunderstandin g 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("What ever").Rows(0). Item(ctr.tag.To String) 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.control s
I hope this helps,
Copr
I hope this helps,
Cor
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 button click. I am not using any
groupbox. how can i determine the control as Editbox and how can i
clear that.
any help would be appreciated.
thanx
|
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 manually. Location, visibility, etc...
There is no support for converting a VB6 project to VB.NET that implemented
control arrays.
|
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!
Problem is I commonly associated several other controls with the same index
inside the event handler - eg a
Directory listbox, Label, Checkbox, Textbox Drivebox etc all associated with
identical index.
Now I see Control arrays belong to VB6...
|
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 which user winsock
control arrays which I ported over to VB.NET 2005 Express Beta 2 using
the upgrade feature. What happened was.. the original array I had set
for my wsArray control was changed in some way which I cant seem to
figure out.
If...
|
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 doesn't have control arrays, so my question is how do I do
the equivalent in VB 2005?
| |
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |