•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 427,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,762 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1152 | Replies: 6
I am usually not keen for asking for help in these kind of situations but I am really stumped when it comes to this, all I really need is a good step in the right direction and I should be (hopefully) fine.
I am currently writing an airplane seating program for my VB class. What I am trying to do is load a text file into an array and then out put it into the list box.
The setup for the txt file is like this:
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
When I execute the program I get a InvalidCastException which said {"Conversion from string "V.. ..." to type 'Double' is not valid."}
The "V.. ...." is from the txt file, from this error from what I am trying to comprehend is that its trying to convert the whole line to double, but I am not sure on how to go about going fixing this small problem, because If i can figure this out then I can figure out the rest of my problem.
Thanks in advanced
I am currently writing an airplane seating program for my VB class. What I am trying to do is load a text file into an array and then out put it into the list box.
Language Syntax (Toggle Plain Text)
Dim seat(15, 6) As Double Dim sr As IO.StreamReader = IO.File.OpenText("plane.txt") For row As Integer = 0 To 6 For col As Integer = 0 To 15 seat(row, col) = CDbl(sr.ReadLine) Next Next listSeat.Items.Clear() listSeat.Items.Add("ABC DEF") Do While sr.Peek <> -1 listSeat.Items.Add(sr.ReadLine) Loop sr.Close() End Sub
The setup for the txt file is like this:
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
When I execute the program I get a InvalidCastException which said {"Conversion from string "V.. ..." to type 'Double' is not valid."}
The "V.. ...." is from the txt file, from this error from what I am trying to comprehend is that its trying to convert the whole line to double, but I am not sure on how to go about going fixing this small problem, because If i can figure this out then I can figure out the rest of my problem.
Thanks in advanced
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- how to validate text file, loading into listbox (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Crystal Report 9.2 Fixed Datasource Location
- Next Thread: Extracting a zip file.



Threaded Mode