.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 25th, 2013, 02:16 PM
jwidener jwidener is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 jwidener User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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?

Reply With Quote
  #2  
Old May 31st, 2013, 11:13 AM
ats0stv ats0stv is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2013
Posts: 7 ats0stv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 46 m 40 sec
Reputation Power: 0
Send a message via Skype to ats0stv
I suppose you should change the code like this
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))
ReDim Preserve decBalanceDue(intNumCustomer)             Input(5, decBalanceDue(intNumCustomer))             intNumCustomer = intNumCustomer + 1
Loop           


Hope this will solve the problem.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > VB2012 - Displaying an Array


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap