Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > 1 to many dynamic controls


Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2004, 10:09 PM
IGBP IGBP is offline
Junior Contributor
 
Join Date: Oct 2003
Location: So. Calif
Posts: 342
Default 1 to many dynamic controls (Resolved)


Hi everyone ...
I am dynamically adding Option buttons based on the result of a database query, and I am ending up with 1 extra control and it is the first record again
Here is the important code....
Code:
Do Until MyRS.EOF strName = MyRS.Fields.Item("CompanyName").Value Option1(i).Caption = strName Load Option1(i + 1) With Option1(i + 1) .Top = Option1(i).Top + Option1(i).Height + 10 .Left = Option1(i).Left .Visible = True .Value = False End With i = i + 1 MyRS.MoveNext Loop
Edit: The RecordCount is correct ..(6) but I end up with 7 option buttons
I have tried
Do ..
Loop Until
Do Until
Do While
Do While NOT ....

Any ideas ?
Thanks,
Michael

Last edited by IGBP; 01-02-2004 at 10:25 PM.
Reply With Quote
  #2  
Old 01-02-2004, 10:19 PM
Dennis DVR's Avatar
Dennis DVR Dennis DVR is offline
Back in the Game

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Manila Philippines
Posts: 3,555
Default

try this.
Code:
Do Until MyRS.EOF strName = MyRS.Fields.Item("CompanyName").Value Option1(i).Caption = strName With Option1(i) If i > 0 Then .Top = Option1(i-1).Top + Option1(i-1).Height + 10 .Left = Option1(i-1).Left End If .Visible = True .Value = False End With i = i + 1 MyRS.MoveNext If Not MyRS.EOF Then Load Option1(i) End If Loop
__________________
Avatar by Lebb

[Posting Guidelines] [Standards & Practices Tutorial] [Participate here effectively]
Our knowledge can only be finite, while our ignorance must necessarily be infinite. Karl Popper
Reply With Quote
  #3  
Old 01-02-2004, 10:25 PM
IGBP IGBP is offline
Junior Contributor
 
Join Date: Oct 2003
Location: So. Calif
Posts: 342
Default

Duane ...
That worked ...
Thank-you very much
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Events on dynamic controls ohmyigod General 2 12-11-2003 01:17 AM
Dynamic Controls AND Arrays VBSmiles General 6 11-20-2003 05:23 PM
Dynamic controls on forms Billyp General 3 06-06-2003 06:19 PM
Dynamic Controls casinglm General 4 03-23-2003 02:05 AM
creating dynamic controls alp0001 General 3 12-05-2002 09:56 PM

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
 
 
-->