Solved

Visual Basic 6 project - Shuffle List box items after every restart

Posted on 2009-06-27
1
325 Views
Last Modified: 2013-11-26
Hi there,

I am doing a project on VB 6. I need help on this.


Present Scenario:

I am populating a list box from a text file but the list box items goes away when program exit.

Envisioned Scenario:

1) List box items will be there even if program exit and re-start.
2) After re-start the list items needs to shuffle randomly. So say I have a list of urls like below, when program re-starts the url order needs to be changed..so I need to shuffle the list.

http://www.shareapic.net/content.php?id=17914085&owner=suvmitra 

http://www.shareapic.net/content.php?id=17914113&owner=suvmitra 

http://www.shareapic.net/content.php?id=17914129&owner=suvmitra 

http://www.shareapic.net/content.php?id=17914138&owner=suvmitra 

http://www.shareapic.net/content.php?id=17914145&owner=suvmitra 

http://www.shareapic.net/content.php?id=17914151&owner=suvmitra 

Sub tell()
Dim nFileNum As Integer, sText As String, sNextLine As String
 
With CommonDialog1
    .DialogTitle = "Select a file"
    .ShowOpen
End With
 
If CommonDialog1.FileName <> "" Then
 
    nFileNum = FreeFile
    Open CommonDialog1.FileName For Input As nFileNum
    
    Do While Not EOF(nFileNum)
        Line Input #nFileNum, sNextLine
        List1.AddItem sNextLine
    Loop
    Close nFileNum
 
End If
End Sub

Open in new window

0
Comment
Question by:suvmitra
1 Comment
 
LVL 5

Accepted Solution

by:
mrcoolcoder earned 500 total points
ID: 24730177
So let me get this strait

1. You want to load the listbox from a textfile, but in random order?
Please see the link below for shuffle code
http://www.xtremevbtalk.com/archive/index.php/t-273841.html

2. You want to the program to save on exit?
Please see the link below for saving from a listbox.
http://www.vbforums.com/showthread.php?t=547320
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# HTTP GET method sample code 3 55
Modal Popup Extender control 1 18
start a process from a service 3 21
VB.Net - MemoryMappedFiles - Confirm receipt 2 17
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now