在将百分比作为程序的一部分时,我不断收到错误消息。
代码如下以及弹出错误的图像。
也是的,是的,我知道我可以增加一些代码行和更少的变量,但此时我很绝望,所以我尝试了任何东西。也对不起我的拼写。
我在下面发布了代码。我希望你能看到我使用的是服务基础数据库。
Public Class record
Dim total As Integer
Dim grade As Integer
Dim letter As String
Dim message As String
Dim porcentaje As Decimal
Dim budget As Integer
Dim divider As Integer
Private Sub AccountTableBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles AccountTableBindingNavigatorSaveItem.Click
Me.Validate()
Me.AccountTableBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)
End Sub
Private Sub record_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1DataSet.report' table. You can move, or remove it, as needed.
Me.ReportTableAdapter.Fill(Me.Database1DataSet.report)
'TODO: This line of code loads data into the 'Database1DataSet.budgetTable' table. You can move, or remove it, as needed.
Me.BudgetTableTableAdapter.Fill(Me.Database1DataSet.budgetTable)
'TODO: This line of code loads data into the 'Database1DataSet.accountTable' table. You can move, or remove it, as needed.
Me.AccountTableTableAdapter.Fill(Me.Database1DataSet.accountTable)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
budget = BudgetNumericUpDown.Value
divider = budget
total = TotalNumericUpDown.Value
porcentaje = total / divider
grade = porcentaje * 100
If grade < 59 Then
letter = "F"
message = "You have fail completly your budget goal please rethink your expenses"
ReportTableAdapter.InsertQueryreport(grade, letter, message)
Dim form1 As report
form1 = New report
form1.Show()
Me.Hide()
ElseIf grade >= 59 And grade < 69 Then
letter = "D"
message = "You have fail part of your budget goal please rethink your expenses a little more"
ReportTableAdapter.InsertQueryreport(grade, letter, message)
Dim form1 As report
form1 = New report
form1.Show()
Me.Hide()
ElseIf grade >= 69 And grade < 79 Then
letter = "C"
message = "You have achive the minimun of your budget goal you can do better"
ReportTableAdapter.InsertQueryreport(grade, letter, message)
Dim form1 As report
form1 = New report
form1.Show()
Me.Hide()
ElseIf grade >= 79 And grade < 89 Then
letter = "B"
message = "You completed more then enough of your budget goal "
ReportTableAdapter.InsertQueryreport(grade, letter, message)
Dim form1 As report
form1 = New report
form1.Show()
Me.Hide()
ElseIf grade >= 89 Then
letter = "A"
message = "You completed you budget goal perfectly congratulation please tell me your secret"
ReportTableAdapter.InsertQueryreport(grade, letter, message)
Dim form1 As report
form1 = New report
form1.Show()
Me.Hide()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim form1 As deposit
form1 = New deposit
form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class