Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > adding to list box


Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2003, 08:36 AM
Donorottie's Avatar
Donorottie Donorottie is offline
Contributor
 
Join Date: Dec 2002
Location: Akron, Ohio USA
Posts: 434
Default adding to list box*RESOLVED*


I am trying to add to a list box from two different sources. In the first case I am adding from lstbox1 to lstbox2. I have this working pretty well. Next I want to add from a txtFile to lstBox2. The text file has the name of a pdf file that I want to have showup in the lstbox2.

Now here is what happens:
If I add the pdf file to lstbox2 first I then can add any item from lstbox1 to lstbox2 but I can't add more than 1 pdf file.
If I add an item from lstbox1 to lstbox2 first then I can't add any pdfs at all.

code to add lstbox items
Code:
'add News Developments to list box 2 Private Sub cmdAddNews_Click() Dim sAdd As String Found_It = False Screen.MousePointer = vbHourglass If lstNews1.ListIndex <> -1 Then sAdd = lstNews1 For iCount = 0 To lstNews2.ListCount - 1 lstNews2.ListIndex = iCount If sAdd = lstNews2 Then Found_It = True Exit For End If Next If Found_It Then MsgBox "This item has already been selected" lstNews2.ListIndex = -1 Else lstNews2.AddItem lstNews1.Text iCount = lstNews2.NewIndex lstNews2.ItemData(lstNews2.NewIndex) = lstNews1.ItemData(lstNews1.ListIndex) Call CreateConnection(objConn) sSQL = "INSERT INTO CAMPAIGNDETAILS(cd_id, cd_type, table_id_number) Values ('" & txtPresentationID.Text & "',('NEWS')," & lstNews2.ItemData(iCount) & ")" objConn.Execute (sSQL) lstNews2.ListIndex = -1 End If End If Screen.MousePointer = vbDefault End Sub


code to add pdf
Code:
Dim sAdd As String Found_It = False sAdd = TxtFile1 For iCount = 0 To lstNews2.ListCount - 1 lstNews2.ListIndex = iCount If sAdd = TxtFile1 Then Found_It = True Exit For End If Next If Found_It Then MsgBox "This item has already been selected" lstNews2.ListIndex = -1 Else lstNews2.AddItem TxtFile1.Text lstNews2.ListIndex = -1 '/////////////////////// COPY PDF FILE TO PDF FOLDER //////////////////////// FileCopy Dir1.Path & "\" & File1.FileName, App.Path & "\" & "pdfs" & "\" & File1.FileName End If
__________________
For fear is nought but the surrender of the helps that come from reason;
and the more one's expectation is of itself uncertain, the more one makes of not knowing the cause that brings on torment.

Wisdom 17 - vs 12:13

Last edited by Donorottie; 07-08-2003 at 10:59 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding to list using a button patriot01 Game Programming 1 01-13-2003 05:37 PM
Intellisense usetheforce2 Miscellaneous Languages 10 10-16-2002 07:48 PM
Adding a distribution list to a distribution list? virgotat Word, PowerPoint, Outlook, and Other Office Products 6 09-06-2002 12:39 PM
ADSI with MS Exchange 5.5 - Adding a user to a distribution list MrPi Communications 4 07-16-2002 10:10 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->