Вы находитесь на странице: 1из 2

Private Sub Btnnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnnew.

Click Dim a As Integer a = MsgBox("Do you want to Save the details", MsgBoxStyle.OkCancel, Me.Text) If a = vbOK Then If Txtname.Text = "" Then MsgBox("Please enter Name of a Member", MsgBoxStyle.Exclamation, Me.Text) ElseIf Txtaddress.Text = "" Then MsgBox("Please enter Address of a Member", MsgBoxStyle.Exclamation, Me.Text) ElseIf gender.Text = "" Then MsgBox("Please select Gender of a Member", MsgBoxStyle.Exclamation, Me.Text) ElseIf Txtpno.Text = "" Then MsgBox("Please enter Contact No. of 10 Digit ", MsgBoxStyle.Exclamation, Me.Text) ElseIf Datetimeadmin.Text = "" Then MsgBox("Please select date of Admission", MsgBoxStyle.Exclamation, Me.Text) ElseIf batch.Text = "" Then MsgBox("Please select batch of a Member", MsgBoxStyle.Exclamation, Me.Text) ElseIf member.Text = "" Then MsgBox("Please select Member type", MsgBoxStyle.Exclamation, Me.Text) ElseIf Lblworkoutlist.Text = "" Then MsgBox("Please select workout for a member from the options", MsgBoxStyle.Exclamation, Me.Text) ElseIf Label1.Text = "" Then MsgBox("Please upload a Photo", MsgBoxStyle.Exclamation, Me.Text) ElseIf feesmode.Text = "" Then MsgBox("Please select fees mode of a Member", MsgBoxStyle.Exclamation, Me.Text) ElseIf Txtreceiptno.Text = "" Then MsgBox("Please enter fees Receipt No.", MsgBoxStyle.Exclamation, Me.Text) Else Try Dim cmd As New OleDbCommand("Insert into admission Values(" & Label2.Text & ",'" & Txtname.Text & "','" & gender.Text & "','" & Txtaddress.Text & "'," & Txtpno.Text & ",'" & Txtpno2.Text & "','" & Datetimeadmin.Text & "','" & batch.Text & "','" & member.Text & "','" & Lblworkoutlist.Text & "','" & Label1.Text & "','" & feesmode.Text & "','" & Txtfeesans.Text & "','" & Txtreceiptno.Text & "','" & DateTimePicker1.Value & "','" & TextBox1.Text & "','" & TextBox2.Text & "')", om) om.Open() cmd.ExecuteNonQuery() MsgBox("Data Successfully Saved!", MsgBoxStyle.Information, Me.Text) om.Close()

Dim cmmand As New OleDbCommand("Insert into extrafees values(" & Label2.Text & ",'" & Txtname.Text & "','" & DateTimePicker2.Text & "')", om) om.Open() cmmand.ExecuteNonQuery() om.Close() Me.Close() Dim o As New Admission o.MdiParent = Welcome.ActiveForm o.Show() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text) If om.State = ConnectionState.Open Then om.Close() End If End Try End If Else Txtaddress.Text = "" Txtname.Text = "" Txtpno.Text = "" Txtpno2.Text = "" Txtreceiptno.Text = "" Txtfeesans.Text = "" End If End Sub

Вам также может понравиться