上記のリンクが表示されますが、数値が入力されると、それらはすべて自動的に合計され、合計が別のボックスに表示されるテキストボックスがいくつかあります。合計が表示されるテキストボックスのコードは次のとおりです。
Try
Dim One As Integer
Dim two As Integer
Dim three As Integer
Dim four As Integer
Dim five As Integer
Dim six As Integer
Dim seven As Integer
If CDbl(txtMon1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtTues1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtWed1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtThurs1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtFri1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtSat1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtSun1.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf String.IsNullOrEmpty(txtMon1.Text) Then
One = CInt(0)
two = CInt(0)
three = CInt(0)
four = CInt(0)
five = CInt(0)
six = CInt(0)
seven = CInt(0)
ElseIf Not IsNumeric(txtMon1.Text) Then
One = CInt(0)
two = CInt(0)
three = CInt(0)
four = CInt(0)
five = CInt(0)
six = CInt(0)
seven = CInt(0)
Else
One = CInt(Convert.ToInt64(txtMon1.Text))
two = CInt(Convert.ToInt64(txtTues1.Text))
three = CInt(Convert.ToInt64(txtWed1.Text))
four = CInt(Convert.ToInt64(txtThurs1.Text))
five = CInt(Convert.ToInt64(txtFri1.Text))
six = CInt(Convert.ToInt64(txtSat1.Text))
seven = CInt(Convert.ToInt64(txtSun1.Text))
txtTot1.Text = CStr(Math.Round(One + two + three + four + five + six + seven))
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub txtTot2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTot2.TextChanged, txtMon2.TextChanged, txtTues2.TextChanged, txtWed2.TextChanged, txtThurs2.TextChanged, txtFri2.TextChanged, txtSat2.TextChanged, txtSun2.TextChanged
Try
Dim One As Integer
Dim two As Integer
Dim three As Integer
Dim four As Integer
Dim five As Integer
Dim six As Integer
Dim seven As Integer
If CDbl(txtMon2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtTues2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtWed2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtThurs2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtFri2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtSat2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf CDbl(txtSun2.Text) > 24 Then
MsgBox(Title:="Error", Prompt:="There not more than 24 hours a day.")
ElseIf String.IsNullOrEmpty(txtMon2.Text) Then
One = CInt(0)
two = CInt(0)
three = CInt(0)
four = CInt(0)
five = CInt(0)
six = CInt(0)
seven = CInt(0)
ElseIf Not IsNumeric(txtMon2.Text) Then
One = CInt(0)
two = CInt(0)
three = CInt(0)
four = CInt(0)
five = CInt(0)
six = CInt(0)
seven = CInt(0)
Else
One = CInt(Convert.ToInt64(txtMon2.Text))
two = CInt(Convert.ToInt64(txtTues2.Text))
three = CInt(Convert.ToInt64(txtWed2.Text))
four = CInt(Convert.ToInt64(txtThurs2.Text))
five = CInt(Convert.ToInt64(txtFri2.Text))
six = CInt(Convert.ToInt64(txtSat2.Text))
seven = CInt(Convert.ToInt64(txtSun2.Text))
txtTot2.Text = CStr(Math.Round(One + two + three + four + five + six + seven))
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
私は何を間違っていますか?