Listbox question

Joined
Aug 21, 2010
Messages
5
Programming Experience
1-3
Hi everyone, Kinda new to this forum and got a question.

I'm making a program that takes common applications and installs them silently using batch files. Someone would select the programs they would want to install and my program will write a giant batch file and execute it to install whatever they want.

Heres the problem,

After the user selects the programs they go into either one or two lists.

Non Silent Installer List

Or

Silent installer list.

Some programs I have simply won't go silently so from there they can choose in what order they want to install these programs. Then there is a combo box that tells weather you want to install non silent programs first or last. From there you hit add to batch file and it would add everything in listbox1 and listbox2 in order. Listbox1 would contain just the text "MalwareBytes" for example. Along with Novell Groupwise and Firefox. How do I get that to add to the Batch List as a code and in order? So the user wants Malware bytes added first to the batch file. How do I add that to my batch list as a completely different code?

echo.
echo. starting malware bytes installer
start /mbam-setup.exe

etc etc etc.

its pretty hard for me to explain and its a real tricky process for me. if you can help me out that would be great. If you need more details or pictures I can do that also.

thanks
 
Code as in just Text. Basically I have a listbox with items that can be moved up or down. Say for example Firefox was an item. From there, once you hit a button. If firefox was first in the list once you hit the button, 5 lines of text would appear in another textbox. Not the same thing as in the first box. Say the Second item was Malware Bytes, After the firefox text in the second listbox would be 5 more lines of text. Let me know if this is confusing still, its pretty complicated to explain let alone create the code for it. I think I have to save the first listbox out as a file. then read it and create variables for each line.

Thanks
 
so you want to take each item in ListBox1 and add 5 lines to ListBox2 ?

if there were 2 items in ListBox1 then you would then have 10 lines total in ListBox2?
 
Private Sub ListBoxExample()

Me.ListBox1.Items.Clear()
Me.ListBox2.Items.Clear()

Dim obj() As String = {"Thunderbird", "FireFox"}
Me.ListBox1.Items.AddRange(obj)

For i As Integer = 0 To Me.ListBox1.Items.Count - 1
'' look at current item in Listbox1 and create
'' a string collection for the listbox2 items
Dim sItem1 As String = Me.ListBox1.Items(i).ToString.ToUpper()
'' i like generic collections but you could just do a string array here
Dim sItemToAdd As New System.Collections.Generic.List(Of String)

Select Case sItem1

Case "Thunderbird".ToUpper()
sItemToAdd.Add("Listbox2 - Thunderbird item 1")
sItemToAdd.Add("Listbox2 - Thunderbird item 2")
sItemToAdd.Add("Listbox2 - Thunderbird item 3")
sItemToAdd.Add("Listbox2 - Thunderbird item 4")
sItemToAdd.Add("Listbox2 - Thunderbird item 5")

Case "FireFox".ToUpper()
sItemToAdd.Add("Listbox2 - FireFox item 1")
sItemToAdd.Add("Listbox2 - FireFox item 2")
sItemToAdd.Add("Listbox2 - FireFox item 3")
sItemToAdd.Add("Listbox2 - FireFox item 4")
sItemToAdd.Add("Listbox2 - FireFox item 5")

'' add more cases here
End Select

Me.ListBox2.Items.AddRange(sItemToAdd.ToArray)

Next i

End Sub
 
Last edited:
Hi again, I know this has been awhile since I wrote this but I just ran into another problem, Say that I only want to install Firefox using this code. IF I click only on firefox the line of code
Dim obj() As String = {"Thunderbird", "FireFox"}
will write the string Thunderbird to listbox1. How do I prevent it from adding it to the list if it wasn't in there already?

thanks
 
then you just remove the thunderbird entry from here:

Dim obj() As String = {"Thunderbird", "FireFox"}

change to:

Dim obj() As String = {"FireFox"}

whatever is in the {} is just a list of items - if you wanted to list the letters A thru E you would say:

Dim obj() As String = {"A", "B", "C", "D", "E"}
 
Back
Top