Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-15-2005, 07:30 PM   #1 (permalink)
 
Newb Techie

Join Date: Oct 2005

Posts: 1

IISaiNtII

Default 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
IISaiNtII is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On