Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Runtime Control Properties


Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2002, 10:52 PM
OsirisHQ
Guest
 
Posts: n/a
Default Runtime Control Properties


Can somebody give me an example of how I would retrieve the properties of labels created at runtime. I would think that it would be like this:

Code:
For intNewControl = 0 to lblTime.Count
      MsgBox lblTime(intNewControl).Property
Next intNewControl
But I get an error saying that the control '2' does not exist in the control array. Thanks for any suggestions.

Osi
Reply With Quote
  #2  
Old 12-27-2002, 11:29 PM
Spike's Avatar
Spike Spike is offline
Senior Contributor
 
Join Date: Jan 2000
Location: Oregon
Posts: 1,008
Default

try looping to lblTime.Ubound.
__________________
Spike
-Sound clip of the week-
The ashes of the dead will be a sign | The time approaches
Killswitch Engage - Numbered Days
Reply With Quote
  #3  
Old 12-27-2002, 11:50 PM
OsirisHQ
Guest
 
Posts: n/a
Default

like this?

Code:
    Dim intIndex As Integer
    For intIndex = 1 To lblTime.UBound
        MsgBox lblTime(intIndex).Caption
    Next intIndex
Tried that and it didn't work.
Reply With Quote
  #4  
Old 12-28-2002, 02:41 AM
Deadalus Deadalus is offline
Promising Talent

Retired Moderator
* Guru *
 
Join Date: May 2002
Location: Brussels
Posts: 3,601
Default

The array usually starts at 0, not 1. Then it should work.
You can also do this, which will also work if an index is missing.
Code:
Dim lbl As Label For Each lbl In Label1 MsgBox lbl.Caption Next
Reply With Quote
  #5  
Old 12-28-2002, 10:37 AM
OsirisHQ
Guest
 
Posts: n/a
Default

Thanks, that worked.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->