Good afternoon,
I've written the code to read the file, and then write the file (same info). It works fine, but I need to increase the amounts from file1 by 10%. File 1 is called "payrates.txt" and file 2 is called "updated2.txt".
I've done conversions and multiplications using input boxes, but never from a file. I've referenced a book, VB Reloaded, and can't find any information. I've also searched the web looking through countless Visual Basic tutorials and the msdn site, only to find the same info. None on reading, multiplying, then writing.
I put in a message box to verify some info, that is not needed.
I also tried to code the calculations, but failed. That code is there, just commented out so you can see my attempts.
Can someone advise?
Thank you,
CODE
Option Explicit On
Option Strict On
Public Class MainForm
Structure Product
Public number As String
Public pay As String
End Structure
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 Object, ByVal e As System.EventArgs) Handles increaseButton.Click
Dim path As String = "C:\Copy of Pay Solution\Pay Project\"
Dim text As String = My.Computer.FileSystem.ReadAllText(path & "payrates.txt")
'Dim isConverted As Boolean
'Dim increase As Integer
'MsgBox(text)
For Each word As String In My.Computer.FileSystem.ReadAllText(path & "payrates.txt")
'increase = Convert.ToDecimal(value as string)
'increase = text * 1.1D
'text.Replace(text, text * 1.1D)
'isConverted = Decimal.TryParse(.text, increase)
My.Computer.FileSystem.WriteAllText _
("C:\Copy of Pay Solution\Pay Project\updated2.txt", text, False)
Next
End Sub
End Class