Public Class ChangeMemNo
Public Sub refresh1()
Dim i As Integer = Me.Controls(0).Controls.Count
Dim j As Integer
For j = 0 To i - 1
If (Me.Controls(0).Controls(j).Name).Substring(0, 3) = "txt" Then
Me.Controls(0).Controls(j).Text = ""
End If
Next
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
refresh1()
TextBox1.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim eno As String
eno = InputBox("Pleasen enter the enrollment no ", "Search1")
If eno = "" Then
Exit Sub
End If
Dim dm As New dmregistration
Dim ds As New DataSet
ds = dm.search(Val(eno))
If ds Is Nothing Then
Exit Sub
End If
txtno.Text = ds.Tables(0).Rows(0)(0)
dtpadmission.Text = FormatDateTime(ds.Tables(0).Rows(0)(3), DateFormat.ShortDate)
txtaddress.Text = ds.Tables(0).Rows(0)(13)
txtcourse.Text = ds.Tables(0).Rows(0)(7)
dtpdob.Text = FormatDateTime(ds.Tables(0).Rows(0)(3), DateFormat.ShortDate)
txtfather.Text = ds.Tables(0).Rows(0)(11)
txtfname.Text = ds.Tables(0).Rows(0)(1)
txtlname.Text = ds.Tables(0).Rows(0)(2)
txtmobile.Text = ds.Tables(0).Rows(0)(15)
txtphno.Text = ds.Tables(0).Rows(0)(14)
txtreligion.Text = ds.Tables(0).Rows(0)(5)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtno.Text = "" Then
MsgBox("Please Search the Record !", MsgBoxStyle.Information)
Exit Sub
End If
If TextBox1.Text = "" Then
MsgBox("Please fill the new value for Membership No!", MsgBoxStyle.Information)
Exit Sub
End If
Dim dm As New dmregistration
dm.change_memeno(Val(txtno.Text), Val(TextBox1.Text))
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class