|Plugged in Online Gaming, and Technology|
| ||Thread Tools|
|02-12-2013, 11:01 PM||#1 (permalink)|
Any Visual Basic Programmers?? I need help!!
'Hey guys, I was wondering if there were any coders that are members on this site. I'm in an introductory Visual Basic class and there is a part of my lab that is confusing me.
Here is the part of the lab that's confusing:
"ReadData button: First it should clear ListBox1. Then it should open a file named data.txt which you can assume has 3 lines in it. Each line is assume to have a name, a space, and then a number on it. Place just the names in the ListBox in backwards order and place the sum of the 3 numbers from the file into the textbox."
I made the data.txt file. I just dont know how to go about placing just the names in the listbox, let alone backwards, and then placing the sum in there too.
Then I have another button to do:
"ReadDataFormat: This does the mostly the same work as the ReadData button, but its output is formatted. First it should clear ListBox1. Then it should open a file named data.txt which you can assume has 3 lines in it. Each line is assume to have a item name, a space, and then a number on it. Place into ListBox1 3 lines each of the form
"itemname" costs "amount"
where itemname and amount are values from the text file. You are required to use a format string and the String.Format function. item names can be as big as 15 characters and amounts are fractional numbers that could be as large as 9999.99. The numbers should be formatted as currency."
So yea... help lol
PBNation Feedback - Pos 84 - Neg 0
|02-13-2013, 02:08 PM||#2 (permalink)|
Join Date: Mar 2008
did you figure it out?
its going to be something like
while file not eof
read line into string
split string on space
put the name into an array or list
total = total + number
reorder the array/list
add to listbox1
Last edited by temps; 02-13-2013 at 02:11 PM.