how can i Initialise 2 dimentional integer array in visual basic 6

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 10
Reputation: mohanvamsi_18 is an unknown quantity at this point 
Solved Threads: 0
mohanvamsi_18 mohanvamsi_18 is offline Offline
Newbie Poster

how can i Initialise 2 dimentional integer array in visual basic 6

 
0
  #1
Jan 8th, 2008
Please tell me ..
how can i Initialise 2 dimentional integer array in visual basic 6.0 .....

if i am giving like this .. it returns error .. at (,)

Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

please guide me ...

i want initialization as globel array ..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,655
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1500
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: how can i Initialise 2 dimentional integer array in visual basic 6

 
0
  #2
Jan 8th, 2008
According to Mastering Visual Basic 6 you have to explicitly declare the array dimensions and arrays can not be initialized like that. You have to set each element one at a time.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 10
Reputation: mohanvamsi_18 is an unknown quantity at this point 
Solved Threads: 0
mohanvamsi_18 mohanvamsi_18 is offline Offline
Newbie Poster

Re: how can i Initialise 2 dimentional integer array in visual basic 6

 
0
  #3
Jan 9th, 2008
Originally Posted by Ancient Dragon View Post
According to Mastering Visual Basic 6 you have to explicitly declare the array dimensions and arrays can not be initialized like that. You have to set each element one at a time.
tanQ............

is there .. any way ..

i have a sting like this 0100001000111011010101101

so .
how can i assing this string of each digit to a(0 to 4, 0 to 4)
i.e.,,, first 0 for a(0,0)
and next 1 for a(0,1) .. like this ..

please ..
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 538
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: how can i Initialise 2 dimentional integer array in visual basic 6

 
0
  #4
Jan 9th, 2008
here is a sample. check this out.

''declaring the array here
Dim a(1, 2) As Integer

''printing values
Private Sub Command1_Click()
Dim i As Integer, j As Integer

For i = 0 To 1 Step 1
For j = 0 To 2 Step 1
Print a(i, j)
Next j
Next i
End Sub

''initializing with default values to all possible subscripts
Private Sub Form_Load()
a(0, 0) = 9 & "," & 19
a(0, 1) = 10 & "," & 20
a(0, 2) = 11 & "," & 21
a(1, 0) = 12 & "," & 22
a(1, 1) = 13 & "," & 23
a(1, 2) = 14 & "," & 24
End Sub

hope this will help you.

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 1932 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC