Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 30th, 2005, 02:40 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
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.

Reply With Quote
  #2  
Old August 31st, 2005, 04:20 PM
snipered's Avatar
snipered snipered is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2005
Location: Birmingham, England
Posts: 909 snipered User rank is Sergeant (500 - 2000 Reputation Level)snipered User rank is Sergeant (500 - 2000 Reputation Level)snipered User rank is Sergeant (500 - 2000 Reputation Level)snipered User rank is Sergeant (500 - 2000 Reputation Level)snipered User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 20 h 48 m 50 sec
Reputation Power: 11
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > selecting multiple values in listbox and deleting them


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT