I have just started to learn VB.i'm making a database using oracle and vb6.
i have a listbox of items and a search button. one can see the details of a particular item in the listbox in a couple of textboxes in that same form by clicking on the search button. can anybody tell me how to delete only the selected item from the listbox along with its details in the associated textboxes???
plss can somebody help me??-

Recommended Answers

All 8 Replies

So, you want to delete the stuff from the VB program, but not the oracle database? The problem, I'm guessing, is that when you delete an item from the listbox, it's not updating the database..... so the information remains? If you post the code, I can take a look for you.

it is deleting from the oracle database,but in my code only the associated text boxes are getting cleared and not the item in the listbox. if i am using prodList.clear then it is clearing the entire list which i dont want. i just want to clear that particular selected item from the listbox, not the rest which i havent selected.
here's the code for deletion:
Private Sub cmdDel_Click()
Dim strMessage As String
' Show contents of buffer and get user input.
Set rs = New ADODB.Recordset
SQL = "SELECT * from product where p_code = " & "'" & prodList.Text & "'"
rs.Open SQL, con, adOpenDynamic, adLockOptimistic
strMessage = "Deletion in progress:" & vbCr & _
"Data in buffer = " & rs!p_code & ", " & _
rs!p_name & " " & vbCr & vbCr
If MsgBox(strMessage, vbYesNoCancel) = vbYes Then
' Delete the record.
rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = ""
' Go to the new record and show the resulting data.
MsgBox "Data in recordset Deleted"
Else
MsgBox "No deletion in PRODUCT table."
End If
prodList.Clear
End Sub

after you clear the textbox's, add this line: prodlist.removeitem prodlist.listindex

;) No Problem.

Hey, do you know how to print a form in vb and the form orientation, Pls help,

do u want the vb code to print something or u want a print of the vb form??

Umn, let's try to keep different questions in seperate threads.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.