VB.NET Help me Please!!!

Status
Not open for further replies.

IISaiNtII

Beta member
Messages
1
problem solved

ok, this solution is due by midnight tonight, and i am freaking out trying to get it to work...

the problem i'm having is getting the "newprices.txt" to write the numbers * percent entered from prices.txt -- all it is writing is 0's

here's what i have so far:

'declare form-level array
Dim sngPrices(9) As Single
Dim i As Integer
Dim Percent As String
Dim path As String = "prices.txt"
Dim NewFile As String = "newprices.txt"
Dim Reader As StreamReader = New StreamReader(path)
Dim Writer As StreamWriter = File.AppendText(NewFile)


Private Sub ExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub

Private Sub IncreaseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IncreaseButton.Click
Percent = InputBox("Enter the percent to increase prices (numbers only).")
For Each i In sngPrices
sngPrices(i) = Val(sngPrices(i)) * ((Percent / 100) + 1)
Writer.WriteLine(sngPrices(i))
Writer.Flush()
Next
End Sub

Private Sub PricesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load the prices.txt file into the sngPrices() array
Do Until (Reader.Peek = -1)
For i = 0 To 9
sngPrices(i) = Reader.ReadLine()
Next
Loop
End Sub

if anyone can take a gander and tell what the heck i'm doing wrong, that would be great!

all help is appreciated, TIA


edit - i got it taken care of
 
Status
Not open for further replies.
Back
Top Bottom