
January 25th, 2013, 02:16 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 16 m 2 sec
Reputation Power: 0
|
|
|
VB2012 - Displaying an Array
I have been trying to display an array into a textbox here lately. I need to have the pieces of information displayed next to each other.
Here is my code so far for displaying the value of the array strCustomers.
Code:
txtCustomers.Multiline = False
txtCustomers.Lines = strCustomers
This displays information that was input from a text file that has two pieces of data in it separated by a comma. The information is displayed like this when I run the program and click the sort button;
John
800
Bill
600
Aron
300
However, I need the information to be displayed like so;
John 800
Bill 600
Aron 300
The code for reading the text file is as follows;
Code:
Dim strMyPath As String
Dim intNumCustomer As Integer
intNumCustomer = 0
strMyPath = CurDir()
FileOpen(5, strMyPath + "\customers.txt", OpenMode.Input)
Do Until EOF(5)
ReDim Preserve strCustomers(intNumCustomer)
Input(5, strCustomers(intNumCustomer))
intNumCustomer = intNumCustomer + 1
Loop
Do Until EOF(5)
ReDim Preserve decBalanceDue(intNumCustomer)
Input(5, decBalanceDue(intNumCustomer))
intNumCustomer = intNumCustomer + 1
Loop
Is there anything I am doing wrong? Or is there a trick to getting it to display the way that I want?
|