0
我有正確的代碼。當我按是的命令將執行,但是當我按下否子不退出它仍然執行命令..可以有人幫助我??即時通訊在VB編程一個newbee。(對不起,我英文)如何使用MSGBOX是否
繼承人的代碼
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim payed As Integer
Dim balance As Integer
Dim paying As Integer
Dim d As Integer
Dim c As Integer
Try
Dim ans As Integer
If TextBox7.Text = "" Or 0 Then
MsgBox("please enter amount", MsgBoxStyle.Critical)
Else
If TextBox6.Text = 0 Then
MsgBox("the student is fully payed", MsgBoxStyle.Critical)
Else
ans = MsgBox(" are you want to upadate the students payment? ", MsgBoxStyle.YesNo, "confirm ")
If MsgBoxResult.Yes Then
payed = Val(TextBox5.Text)
balance = Val(TextBox6.Text)
paying = Val(TextBox7.Text)
d = payed + paying
c = balance - paying
TextBox5.Text = d
TextBox6.Text = c
Dim SqlQuery = "UPDATE sample SET [Payed Amount] ='" & TextBox5.Text & "',Balance ='" & TextBox6.Text & "' WHERE ID = " & a & " ; "
Dim sqlcommand As New OleDbCommand
With sqlcommand
.CommandText = SqlQuery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("student payment succesfully updated")
My.Computer.Audio.Play(My.Resources.CASHREG, AudioPlayMode.Background)
If TextBox6.Text = 0 Then
MsgBox("the student is now fully paid", MsgBoxStyle.Information)
TextBox7.Text = ""
Else
MsgBox("students current balance is " & Convert.ToString(TextBox6.Text))
LoadListView()
TextBox7.Text = ""
End If
Else
Exit Sub
End If
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try