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 the following in vb.net with this
vb6 way:
In vb6, I would create five labels array on a form:
lblDisplay(1)...lblDisplay(5), and in each label I would have tag property:
Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset
for i = 1 to lblDisplay.Count
rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag &
"'")
lblDisplay(i).Caption = rst!Value
next i
How would I do this in VB.NET? I read some books, they mentioned about
using the Tag property to identify the control, but I want to get your
opinion on this.
Thanks!!! 7 15601
This should get you started:
In the Load event of a form:
Dim LBL(5) As Label
Dim i As Int32
For i = 0 To 5
LBL(i) = New Label()
LBL(i).Top = i * 22
LBL(i).Text = "LBL" & i.ToString
Me.Controls.Add(LBL(i))
Next
You can use a Datatable instead of a Recordset as your data store.
The .Net Label has a Tag property. www.charlesfarriersoftware.com
"anthony" wrote: 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 the following in vb.net with this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
This should get you started:
In the Load event of a form:
Dim LBL(5) As Label
Dim i As Int32
For i = 0 To 5
LBL(i) = New Label()
LBL(i).Top = i * 22
LBL(i).Text = "LBL" & i.ToString
Me.Controls.Add(LBL(i))
Next
You can use a Datatable instead of a Recordset as your data store.
The .Net Label has a Tag property. www.charlesfarriersoftware.com
"anthony" wrote: 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 the following in vb.net with this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
Anthony,
Yes I have answered this often, however it is simple, create yourself that
array of labels and than you can use the code as you do. Using VBNet you can
put any control in an array and mixed exactly as you want.
dim myLblArr() as label = new label() {label1,label2,label3,label5,etc)
As question, is there any reason why you use ADODB, with that you have
forever to deploy as well the DLL, why not ADONET?
I hope this helps?
Cor
"anthony" 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 the following in vb.net with this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
Anthony,
Yes I have answered this often, however it is simple, create yourself that
array of labels and than you can use the code as you do. Using VBNet you can
put any control in an array and mixed exactly as you want.
dim myLblArr() as label = new label() {label1,label2,label3,label5,etc)
As question, is there any reason why you use ADODB, with that you have
forever to deploy as well the DLL, why not ADONET?
I hope this helps?
Cor
"anthony" 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 the following in vb.net with this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
Thanks for your reply,
It looks like I have to create the label controls in run time.
"Charlie" <Ch*****@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com... This should get you started:
In the Load event of a form:
Dim LBL(5) As Label Dim i As Int32 For i = 0 To 5 LBL(i) = New Label() LBL(i).Top = i * 22 LBL(i).Text = "LBL" & i.ToString Me.Controls.Add(LBL(i)) Next
You can use a Datatable instead of a Recordset as your data store.
The .Net Label has a Tag property.
www.charlesfarriersoftware.com
"anthony" wrote:
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 the following in vb.net with
this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag
property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
Thanks,
Looks like I have to create the labels in run time, can it be done in design
time?
I used ADODB because I don't know much about ADONET, the project now didn't
allow me much time to research, but certainly now I will look at this in
depth.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl... Anthony,
Yes I have answered this often, however it is simple, create yourself that array of labels and than you can use the code as you do. Using VBNet you
can put any control in an array and mixed exactly as you want.
dim myLblArr() as label = new label() {label1,label2,label3,label5,etc)
As question, is there any reason why you use ADODB, with that you have forever to deploy as well the DLL, why not ADONET?
I hope this helps?
Cor
"anthony"
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 the following in vb.net with this vb6 way:
In vb6, I would create five labels array on a form: lblDisplay(1)...lblDisplay(5), and in each label I would have tag property: Display1...Display5.
Then, in code (omitted some connection string below):
rst = new ADODB.Recordset for i = 1 to lblDisplay.Count rst.open("select Value from Tags where Name='" & lblDisplay(i).Tag & "'") lblDisplay(i).Caption = rst!Value next i
How would I do this in VB.NET? I read some books, they mentioned about using the Tag property to identify the control, but I want to get your opinion on this.
Thanks!!!
Anthony,
You don't have to create the labels in runtime.
Only that array I showed you, in another format.
dim myLblArr() as label = {label1,label2,label3,label5,etc}
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Raymond H. |
last post by:
Hello,
1- How to see, in a Label, the URL of a link that the mouse pass over?
(in the WebBrower control in a vb projet).
2- How to create a menu and a submenu via a button Command1? and...
|
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: 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: jcrouse |
last post by:
I am rotating some text is some label controls. In the one place I use it it
works fine. In the other place I use it I can't figure out the syntax. I
don't really understand the event. Where it...
|
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: Neo |
last post by:
hi ,
i was trying to use textboxes and labels in a repeater control. If
in case the value of the text boxes are changed then the changed
textbox value and the label has to be added to two...
|
by: Arpan |
last post by:
Consider the following code snippet (my main intention is to display
the current time in a Label control as & when this ASPX page is
accessed/refreshed):
<script runat="server">
Class Clock...
|
by: rn5a |
last post by:
Consider the following code:
<script runat="server">
Sub ShowData(obj As Object, ea As EventArgs)
lblDate.Text = DateTime.Now.ToString("d")
lblDate.DataBind()
End Sub
</script>
<form...
|
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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: 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: 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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |