Solved

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

Posted on 2009-06-27
1
324 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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

10 Experts available now in Live!

Get 1:1 Help Now