Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class FormAPCalc
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
- update_values()
- End Sub
- Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- AboutAPCalc.Show()
- End Sub
- Private Sub NumericUpDown2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown2.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown3_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown3.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown4_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown4.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown5_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown5.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown6_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown6.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown7_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown7.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown8_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown8.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown9_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown9.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown10_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown10.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown11_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown11.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown12_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown12.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown13_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown13.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown14_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown14.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown15_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown15.ValueChanged
- update_values()
- End Sub
- Private Sub NumericUpDown16_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown16.ValueChanged
- update_values()
- End Sub
- Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
- End Sub
- Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
- update_values()
- End Sub
- Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
- End Sub
- 'LMA: Load the data file.
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("Data/data.txt")
- Dim temp As Integer = 0
- Dim is_ok As Boolean = False
- MyReader.TextFieldType = FileIO.FieldType.Delimited
- MyReader.SetDelimiters(",")
- Dim currentRow As String()
- While Not MyReader.EndOfData
- Try
- temp = 0
- currentRow = MyReader.ReadFields()
- Dim currentField As String
- For Each currentField In currentRow
- temp += 1
- is_ok = True
- Select Case temp
- Case 1
- NumericUpDown1.Value = Val(currentField)
- Case 2
- NumericUpDown2.Value = Val(currentField)
- Case 3
- NumericUpDown3.Value = Val(currentField)
- Case 4
- NumericUpDown4.Value = Val(currentField)
- Case 5
- NumericUpDown5.Value = Val(currentField)
- Case 6
- NumericUpDown6.Value = Val(currentField)
- Case 7
- NumericUpDown7.Value = Val(currentField)
- Case 8
- NumericUpDown8.Value = Val(currentField)
- Case 9
- NumericUpDown9.Value = Val(currentField)
- Case 10
- NumericUpDown10.Value = Val(currentField)
- Case 11
- NumericUpDown11.Value = Val(currentField)
- Case 12
- NumericUpDown12.Value = Val(currentField)
- Case 13
- NumericUpDown13.Value = Val(currentField)
- Case 14
- NumericUpDown14.Value = Val(currentField)
- Case 15
- NumericUpDown15.Value = Val(currentField)
- Case 16
- NumericUpDown16.Value = Val(currentField)
- Case 17
- TextBox2.Text = currentField
- End Select
- Next
- Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
- MsgBox("Problem loading the file!")
- End Try
- End While
- If is_ok Then
- MsgBox("Ap loaded!")
- Else
- MsgBox("Nothing to load!")
- End If
- update_values()
- End Using
- End Sub
- 'LMA: Saving button
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim temp As String
- temp = ""
- temp += NumericUpDown1.Value.ToString + "," + NumericUpDown2.Value.ToString + "," + NumericUpDown3.Value.ToString + "," + NumericUpDown4.Value.ToString + ","
- temp += NumericUpDown5.Value.ToString + "," + NumericUpDown6.Value.ToString + "," + NumericUpDown7.Value.ToString + "," + NumericUpDown8.Value.ToString + ","
- temp += NumericUpDown9.Value.ToString + "," + NumericUpDown10.Value.ToString + "," + NumericUpDown11.Value.ToString + "," + NumericUpDown12.Value.ToString + ","
- temp += NumericUpDown13.Value.ToString + "," + NumericUpDown14.Value.ToString + "," + NumericUpDown15.Value.ToString + "," + NumericUpDown16.Value.ToString
- 'personnal AP value.
- temp += "," + TextBox2.Text
- My.Computer.FileSystem.WriteAllText("Data/data.txt", temp, False)
- MsgBox("Ap Saved!")
- End Sub
- 'LMA: reset button.
- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
- NumericUpDown1.Value = 0
- NumericUpDown2.Value = 0
- NumericUpDown3.Value = 0
- NumericUpDown4.Value = 0
- NumericUpDown5.Value = 0
- NumericUpDown6.Value = 0
- NumericUpDown7.Value = 0
- NumericUpDown8.Value = 0
- NumericUpDown9.Value = 0
- NumericUpDown10.Value = 0
- NumericUpDown11.Value = 0
- NumericUpDown12.Value = 0
- NumericUpDown13.Value = 0
- NumericUpDown14.Value = 0
- NumericUpDown15.Value = 0
- NumericUpDown16.Value = 0
- TextBox1.Text = ""
- TextBox2.Text = ""
- TextBox3.Text = ""
- End Sub
- 'LMA: updating values.
- Private Sub update_values()
- Dim temp As Integer
- temp += 0
- temp += NumericUpDown1.Value * 300
- temp += NumericUpDown2.Value * 600
- temp += NumericUpDown3.Value * 900
- temp += NumericUpDown4.Value * 1200
- temp += NumericUpDown5.Value * 600
- temp += NumericUpDown6.Value * 1200
- temp += NumericUpDown7.Value * 1800
- temp += NumericUpDown8.Value * 2400
- temp += NumericUpDown9.Value * 1200
- temp += NumericUpDown10.Value * 2400
- temp += NumericUpDown11.Value * 3600
- temp += NumericUpDown12.Value * 4800
- temp += NumericUpDown13.Value * 2400
- temp += NumericUpDown14.Value * 4800
- temp += NumericUpDown15.Value * 7200
- temp += NumericUpDown16.Value * 9600
- TextBox3.Text = temp
- TextBox1.Text = Val(TextBox3.Text) + Val(TextBox2.Text)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement