| | |
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
![]() |
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.
•
•
Join Date: Jan 2008
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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.
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 ..
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
''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.
Have a problem? Don't worry just give me a call and I'll fix it for you.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: win32 exception unhandled
- Next Thread: public variable problems
Views: 1932 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






