|
-
Nov 8th, 2002, 04:12 PM
#1
Thread Starter
New Member
simple question, drawing a blank
its been along time since ive coded in VB, in fact i was using vb 4 the last time i did anything. now i am using vb.net. question is a have 35 labels on a form. i want to update them all in a do until loop to save time. how do i merge a integer type variable with a control name? the labels are label1, label2, label3, etc.
ex.
x = 0
do until x = 35
label*x*.text = val(x)
x = x + 1
loop
that is just a rough sample of what i am trying to do. my question is what is the proper syntax for the label*x*.text portion?
thanks
-Nick
-
Nov 8th, 2002, 04:51 PM
#2
well you could loop through forms.controls and check for the control's name. It wouldnt be very efficient though.... something like this:
VB Code:
Dim ctrl As Control
For Each ctrl In Me.Controls
'Examine all the controls here
Next
I would say it's better to do it manually though
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Nov 8th, 2002, 04:53 PM
#3
err here, this check for every control whose name starts with "Label"
VB Code:
Dim ctrl As Control
For Each ctrl In Me.Controls
If Mid$(ctrl.Text, 1, Len("lable")) = "Label" Then
ctrl.Text = Mid$(ctrl.Name, Len("label") + 1)
End If
Next
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|