Private Sub BtnFind_Click(sender As Object, e As EventArgs) Handles BtnFind.Click
Dim id As Integer
con = New SqlConnection("Data Source=.;Initial Catalog=Church_Management_System;
Integrated Security=True")
con.Open()
id = Val(InputBox("Enter Membership ID", "FIND MEMBER"))
sqlstr = "SELECT Membership_Id, tithe_Id, FName, MName, LName, DoB,
Gender,Occupation, Place_of_Birth, Baptised, Communicant, statuss, Marital_Status,
Bio, country, addresss, Town, Phone, work_phone, Mobile, email, pic, FROM MEMBERSHIP
WHERE MEMBERSHIP_ID='" & Membership_IdTextBox.Text & "'"
cmd = New SqlCommand(sqlstr, con)
dr = cmd.ExecuteReader
If dr.HasRows = True Then
While dr.Read()
Membership_IdTextBox.Text = dr(0)
Tithe_IdTextBox.Text = dr(1)
FNameTextBox.Text = dr(2)
MNameTextBox.Text = dr(3)
LNameTextBox.Text = dr(4)
DoBDateTimePicker.Value = dr(5)
GenderComboBox.SelectedItem = dr(6)
OccupationTextBox.Text = dr(7)
Place_of_BirthTextBox.Text = dr(8)
BaptisedCheckBox.Checked = dr(9)
CommunicantCheckBox.Checked = dr(10)
StatussCheckBox.Checked = dr(11)
Marital_StatusComboBox.SelectedItem = dr(12)
BioTextBox.Text = dr(13)
CountryComboBox.SelectedItem = dr(14)
AddresssTextBox.Text = dr(15)
TownTextBox.Text = dr(16)
PhoneTextBox.Text = dr(17)
Work_phoneTextBox.Text = dr(18)
MobileTextBox.Text = dr(19)
EmailTextBox.Text = dr(20)
Pic.Image. = dr(21)
Entry_dateDateTimePicker.Value = dr(22)
End While
MsgBox("Record Found")
End If