The code i have written (in VB)is :
Dim dbMyDB As Database
Dim rsMyRS As Recordset
Private Sub cmd_Delete_Click()
rsMyRS.Delete
userlist.RemoveItem userlist.ListIndex
End Sub
Private Sub cmd_Display_Click()
Set rsMyRS = dbMyDB.OpenRecordset("PC_User_Details", dbOpenDynaset)
rsMyRS.MoveFirst
If nm_txt.Text = rsMyRS!Name Then
If rsMyRS.RecordCount > 0 Then
name_txt.Text = rsMyRS!Name
ip_txt.Text = rsMyRS!ip
pass_txt.Text = rsMyRS!Password
dept_txt.Text = rsMyRS!department
ext_txt.Text = rsMyRS!extension
user_name.Text = rsMyRS!User
Else: MsgBox "The Name doen't Exists!!", vbOKOnly + vbCritical, "Invalid Record"
End If
Else: MsgBox "There are no Records in the DataBase!!", vbOKOnly + vbCritical, "No Information"
End If
rsMyRS.MoveNext
End Sub
Private Sub cmd_Exit_Click()
End
End Sub
Private Sub Form_Load()
Set dbMyDB = OpenDatabase("Users.mdb")
Set rsMyRS = dbMyDB.OpenRecordset("PC_User_Details", dbOpenDynaset)
If Not rsMyRS.EOF Then rsMyRS.MoveFirst
Do While Not rsMyRS.EOF
userlist.AddItem rsMyRS!Name
rsMyRS.MoveNext
Loop
End Sub
Private Sub userlist_DblClick()
Set rsMyRS = dbMyDB.OpenRecordset("PC_User_Details", dbOpenDynaset)
name_txt.Text = rsMyRS!Name
ip_txt.Text = rsMyRS!ip
pass_txt.Text = rsMyRS!Password
dept_txt.Text = rsMyRS!department
ext_txt.Text = rsMyRS!extension
user_name.Text = rsMyRS!User
End Sub