|
-
Jun 23rd, 2000, 01:06 AM
#1
Thread Starter
Frenzied Member
Hi all!
I'making a program scheduler wich runs programs when loaded.
I use two textfields AppName & AppPath to save the Application name and full path to a ListBox
and the registry. I also saves the varible AppNo & AppPathNo which shows how many apps saved.
I need to fill the listbox with programs added so far when i reload the program, and the run them. How in the world do i
do that!!!!!
This is what I written so far....
Code:
Private Sub CmdAdd_Click()
Dim AppNo
Dim AppPathNo
AppNo = GetSetting("ProgSch", "AppNo", "No")
AppPathNo = GetSetting("ProgSch", "PathNo", "No")
If AppNo >= 10 Or AppPathNo >= 10 Then
GoTo Error
Else
AppNo = AppNo +1
SaveSetting "ProgSch", "AppNo", "No", AppNo
AppPathNo = AppPathNo +1
SaveSetting "ProgSch", "PathNo", "No", AppPathNo
SaveSetting "ProgSch", "AppToRun", AppNo, AppName
SaveSetting "ProgSch", "AppPath", AppPathNo, AppPath
Apps.AddItem AppName.Text & " " & "-" & " " & AppPath
Exit Sub
Error:
Dim Msg
Msg = MsgBox("Error! You can only add 10 applications!", vbCritical)
End If
End Sub
Private Sub Form_Load()
Dim StartNoCheck1
Dim StartNoCheck2
StartNoCheck1 = GetSetting("ProgSch", "AppNo", "No")
StartNoCheck2 = GetSetting("ProgSch", "PathNo", "No")
If StartNoCheck1 = "" Then
SaveSetting "ProgSch", "AppNo", "No", "0"
End If
If StartNoCheck2 = "" Then
SaveSetting "ProgSch", "PathNo", "No", "0"
End If
End Sub
Thanx in advange!
[Edited by CyberCarsten on 06-23-2000 at 02:09 PM]
-
Jun 23rd, 2000, 02:17 AM
#2
Lively Member
All you would have to do is retrieve all of the Apps from the registry exactly how you put them in. For Example:
You already have AppNo....
Dim i as ineteger
Dim strAppName as String
Dim strAppPath as String
For i = 1 to AppNo
'Get AppName
strAppName = GetSetting("ProgSch", "AppToRun", i)
'Get AppPath
strAppPath = GetSetting("ProgSch", "AppPath", i)
'Load Both into Listbox
Listbox1.AddItem strAppName & " - " & strAppPath
Next
This should load all of the registry entries into the Listbox....
Hope this helps!
-
Jun 23rd, 2000, 03:08 AM
#3
Thread Starter
Frenzied Member
-
Jun 23rd, 2000, 03:14 AM
#4
Thread Starter
Frenzied Member
Never mind I fixed it!!! : o ))
Do you know how to delete a selected item in a listbox??
-
Jun 23rd, 2000, 03:36 AM
#5
Lively Member
First, you have to cycle trhu to see which is selected...
Dim i as Integer
Dim iSelected as Integer
For i = 0 to (Listbox.ListCount - 1)
If Listbox.Selected(i) = True then
iSelected = i
Exit For
End If
Next
Then you can Delete the Selected Record....
Listbox1.RemoveItem iSelected
Listbox1.Refresh
Make sure you refresh the Listbox....
-
Jun 23rd, 2000, 03:54 AM
#6
Thread Starter
Frenzied Member
Thanks my friend!! You have been a great help!!
-
Jun 23rd, 2000, 03:56 AM
#7
Lively Member
Anytime. Glad I can help! I have certainly gotten it many times from this board!!!
Kevin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|