Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > 2 Dimensional Control Arrays


Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2001, 06:45 PM
diver diver is offline
Senior Contributor

* Expert *
 
Join Date: Jun 2001
Location: Illinois
Posts: 865
Default 2 Dimensional Control Arrays


Does anyone know if there is a way to do a two dimensional control array? This is how it would be used...

Imagine one Form, with 5 frames (Index 0-4), and 10 combo boxes inside of each frame (Indexes 0-9).

Notice the "1" and the "2" when making reference to these controls...

Form1.frm
frame_test1(0) - (4)
combo_test1(0) - (9)

frame_test2(0) - (4)
combo_test2(0) - (9)

etc...
Basically, it takes up "code space" to have to specifically identfity the "1"s and the "2"s in the control names. I can't use 0-9, 10-19, etc., because I am creating the controls dymically.

Thanks!
__________________
Sometimes I do not get notification of your post from the forum, which causes a delay. I am apologizing in advance!
Reply With Quote
  #2  
Old 10-10-2001, 07:12 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default Re: 2 Dimensional Control Arrays

Unfortunately no, you cant have multidimensional control arrays. You can solve your problem using modulo arithmetic. You would have an array of combos only (0 to 39)

To find out which frame combo(23) is in we do:

<pre>FrameNo = 23 Mod 4</pre>

which returns 3, so combo box 23 is in frame 3, assuming frames go from 0 to 3.

Combo 13 goes in frame one (13 Mod 4 = 1). and so on.......
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #3  
Old 10-10-2001, 08:13 PM
diver diver is offline
Senior Contributor

* Expert *
 
Join Date: Jun 2001
Location: Illinois
Posts: 865
Default Re: 2 Dimensional Control Arrays

thanks Squirm.
Let me try that out.

-Diver
__________________
Sometimes I do not get notification of your post from the forum, which causes a delay. I am apologizing in advance!
Reply With Quote
  #4  
Old 10-11-2001, 05:54 AM
Laurent Laurent is offline
Senior Contributor

Retired Leader
* Expert *
 
Join Date: Apr 2001
Location: canada, quebec
Posts: 1,334
Default Re: 2 Dimensional Control Arrays

in the same state of mind you can use the first digit to determine witch tab you're in like this

1,2,3,4,5,6 would all be in tab 0
11,12,13,14,15 would all be in tab 1
21,22,23,24,25 would all be in tab 2
31,32,33,34,35 would all be in tab 3

just do fix ((index)/10)
__________________
Still tons to learn!
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
 
 
-->