Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 13th, 2003, 12:15 PM
drew010 drew010 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: california usa
Posts: 346 drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 9 h 33 m 12 sec
Reputation Power: 12
Send a message via ICQ to drew010 Send a message via AIM to drew010 Send a message via Yahoo to drew010
Array() Function, 2 Dimensional Array

I cant figure out how to use the array function to initialize a 2 dimensional array.

i have a basic 9x9 list i need in an array

Its for an assignment and the teacher said dont use Form_Load methods where you assign each subscript a value, but to use the array function. simple for one dimension but i cant figure it out for two.

VB says
"Array(ParamArray ArgList() As Variant)"

Help please

Reply With Quote
  #2  
Old November 13th, 2003, 08:02 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
if u will define a 2 dimensional array,u can do it:
dim arglist(1 to 9,1 to 9) as integer
When u will assign to the member of this array,u can do it:
arglist(x,y)=z
x:1st dimensional member's number
y:2th dimensional member's number
z:assign value

Reply With Quote
  #3  
Old November 13th, 2003, 08:19 PM
drew010 drew010 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: california usa
Posts: 346 drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level)drew010 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 9 h 33 m 12 sec
Reputation Power: 12
Send a message via ICQ to drew010 Send a message via AIM to drew010 Send a message via Yahoo to drew010
i know how to assign to a 2d array using that method, but that would require 80 lines of code since im hard coding a static table of information. the teacher specifically said not to do it that way and use the Array() function to insert the data.
i know for a 1d array its
intArr = Array(x, x, x, x, x)
but for a 2d i cant figure it out.

Reply With Quote
  #4  
Old November 14th, 2003, 07:51 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,169 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 8 h 34 m 4 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
who told you to do it this way? Are you supposed to assign the entire array at once, or can you do it a subscript at a time? The reason I ask is, I don't know any way to do what you're proposing. If you find out, please post it.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #5  
Old November 14th, 2003, 08:30 AM
Unkie Unkie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 32 Unkie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 5
here's your solution, drew

Dim arglist(9) As Variant

arglist(0) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(1) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(2) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(3) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(4) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(5) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(6) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(7) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
arglist(8) = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
For i = 0 To 8
For j = 0 To 8
MsgBox arglist(i)(j) + arglist(i)(j) 'proof of being integer as type

Next j
Next i

Reply With Quote
  #6  
Old November 14th, 2003, 08:52 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
Yes,Unkie's answer is Creative!

Reply With Quote
  #7  
Old November 14th, 2003, 11:28 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,169 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 8 h 34 m 4 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
interesting solution - good job Unkie!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Array() Function, 2 Dimensional Array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway