vb, visual basic, vb6, use array to add value, use array to read value, how to use array to add, get value, read static array, write static array how to use array
(Website Helper) how to use array Number of Visitors: Site Map

vb: how to read and write array?



Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
This site provides users with the information about vb, visual basic, vb6, how to read array, how to write array, use array to add value, use array to read value, how to use array to add, get value, read static array, write static array, and more.

If you think that this site is helpful, please recommend your friends to visit our site.



vb: how to read and write array?

The following is the way to read and write array in visual basic programming:

Private Sub Command6_Click()

    Dim LinesArr() As String
    ReDim LinesArr(50)
    Dim tmp As Integer
    Dim LinesRead As Integer
    LinesRead = 0
    
    Open App.Path & "\sorteddate.txt" For Input As #1  
    Do While Not EOF(1)
        If LinesRead = UBound(LinesArr) Then
           ReDim Preserve LinesArr(UBound(LinesArr) + 50)
        End If
         'read a line
         Line Input #1, LinesArr(LinesRead)
         LinesRead = LinesRead + 1
      
        DoEvents
    Loop
    'redim to actual size
    ReDim Preserve LinesArr(LinesRead - 1)
    Close #1

    For tmp = 0 To UBound(LinesArr)
        MsgBox LinesArr(tmp)
    Next tmp
End Sub

Use of static array as follows:

Dim tmp As Integer
    
tmp1 = "001121"
tmp2 = "001122"
tmp3 = "001123"
    
Dim mArray, mDay
mArray = Array(tmp1, tmp2, tmp3)

' Return values assume lower bound set to 1 
' (using Option Base statement).

'mDay = mWeek(2)   ' mDay contains "Tue".
'mDay = mWeek(4)   ' mDay contains "Thu".
    
For tmp = 0 To UBound(mArray)
   MsgBox mArray(tmp)
Next tmp

(Website Helper) how to use array (c) EduSoftMax - www.edusoftmax.com