- Joined
- Dec 22, 2007
- Messages
- 184 (0.03/day)
- Location
- Central Nebraska
System Name | CORSAIR |
---|---|
Processor | AMD Phenom 1090T x6 @3.2 |
Motherboard | Gigabyte Ga-78LMT-S2P |
Cooling | High efficiency dust cooling |
Memory | 8GB GSkill DDR3 1333 |
Video Card(s) | Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic |
Storage | Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE) |
Display(s) | Dell 20" LCD, Dell 17" LCD |
Power Supply | Antec Cool Blue 650W Modular |
Software | Windows 7 Professional SP1, Visual Studio 2010 Ultimate |
Me and a buddy have an assignment to write a program in visual basic that allows you to calculate interest, etc. on a loan. We've been sitting for hours tryign to figure out streamwriter because the program must also be able to save the input to the text boxes used to calculate the loan info to a text file.
If anyone could tell us the error of our ways, it would be much appreciated
Imports System.IO
Public Class Console_MAIN
Private Sub Console_MAIN_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
'closes the program
Me.Close()
End Sub
Private Sub Button_Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Exit.Click
'closes the program
Me.Close()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
AboutBox1.Show()
End Sub
Private Sub Button_UpdateSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_UpdateSchedule.Click
Dim VAR_LoanAmount As Decimal
Dim VAR_LoanRate As String
Dim VAR_LoanPeriod As Decimal
Dim LoanInfo As StreamWriter
VAR_LoanAmount = TextBox_LoanAmount.Text
VAR_LoanRate = ComboBox_AnnualRate.Text
VAR_LoanPeriod = TextBox_Years.Text
LoanInfo = New IO.StreamWriter("loaninfo.txt", True)
Try
LoanInfo.WriteLine(Now())
LoanInfo.Write(VAR_LoanAmount, VAR_LoanRate, VAR_LoanPeriod)
LoanInfo.WriteLine()
LoanInfo.WriteLine()
Catch
MessageBox.Show("Error writing file")
End Try
End Sub
End Class
This has resulted in a blank text file, and if you click the button again, it crashes the program. Please help!
If anyone could tell us the error of our ways, it would be much appreciated
Imports System.IO
Public Class Console_MAIN
Private Sub Console_MAIN_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
'closes the program
Me.Close()
End Sub
Private Sub Button_Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Exit.Click
'closes the program
Me.Close()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
AboutBox1.Show()
End Sub
Private Sub Button_UpdateSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_UpdateSchedule.Click
Dim VAR_LoanAmount As Decimal
Dim VAR_LoanRate As String
Dim VAR_LoanPeriod As Decimal
Dim LoanInfo As StreamWriter
VAR_LoanAmount = TextBox_LoanAmount.Text
VAR_LoanRate = ComboBox_AnnualRate.Text
VAR_LoanPeriod = TextBox_Years.Text
LoanInfo = New IO.StreamWriter("loaninfo.txt", True)
Try
LoanInfo.WriteLine(Now())
LoanInfo.Write(VAR_LoanAmount, VAR_LoanRate, VAR_LoanPeriod)
LoanInfo.WriteLine()
LoanInfo.WriteLine()
Catch
MessageBox.Show("Error writing file")
End Try
End Sub
End Class
This has resulted in a blank text file, and if you click the button again, it crashes the program. Please help!