|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
selecting multiple values in listbox and deleting them
Hi,
I have one listbox, in which i can select multiple names. I have one delete button which when clicked all the selected names should be deleted from the listbox. How to achieve this? Please its urgent. Can someone give me sample code for this. Thanx in advance. Any help will be appreciated. |
|
#2
|
||||
|
||||
|
Can be done pretty simply.
I do the same however i create records given the value of the listbox. You can adapt it to yours. When you call the recordset just delete instead of updating. Code:
Private Sub Generate_Click() cmdprintall.Enabled = True check End Sub Code:
Sub check()
On Error GoTo errorhandler
Dim c As Integer
Dim X As Integer
Dim arr() As String
c = 0
For X = 0 To List1.ListCount - 1
If List1.Selected(X) = True Then
ReDim Preserve arr(c)
arr(c) = List1.List(X)
c = c + 1
End If
Next X
If UBound(arr) > 0 Then
For X = 0 To UBound(arr)
FrmInvoice.dbnamesl.Text = arr(X)
Set rsp = showpurchasenamesmultiple
Set objrs = GetDatamultiple
savemultiplerecord
FrmInvoice.dbnamesl.Clear
FrmInvoice.dbnamesl.Text = ""
Next X
End If
MsgBox "All invoices were created successfully", vbInformation, "Successfully Created"
Exit Sub
errorhandler:
MsgBox "No Items were selected. Please select items from the list", vbCritical, "Too Few Items"
End Sub
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > selecting multiple values in listbox and deleting them |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|