Missing a namespace?

pruebens

Well-known member
Joined
Nov 21, 2002
Messages
71
Im missing a namespace that I hope someone can point out for me. What Im doing is populating a listbox then applying those results into a variable that gets passed back to a database.

However in my code I have this in a for next loop:

dim s as string

If listbox1.(I wanted to put GetSelected(nCounter) here but that option isnt available)
s = s & listbox1.items(nCounter) <-- nCounter is the variable for the for next loop however I get an error that says: "Operator & is not defined for types String"
End if


I am assuming that I am merely not importing the correct namespace but for the life of me I cant think of one that Im missing. Thanks to anyone that can help me out
 
Okay a little update......I have my form now doing (sort of) what I need it do. being a n00b I had to figure this out on my own and the following code is what I have:

Code:
Dim nCounter As Short
        For nCounter = 0 To printers.Items.Count - 1
            If Not IsNothing(printers.SelectedItem) Then
                print = print & printers.SelectedItem.Text
            End If
        Next

As you can see what Im doing is populating a listbox with the currently installed printers then passing them back to a variable (thanks Robby) then updating that with a database. Which that procedure works.

However, if they select MULTIPLE entries then it updates the variable with the first listed printer however many times you selected another printer. For instance a user brings up this form, sees a list of 5 printers. He clicks on 1 and 5 then clicks the button to start the routine to update the database. But instead of updating the dbase with the names of 1 and 5....1 is listed twice.

Im obviously missing something and I hope someone can help me fix this
 
Last edited by a moderator:
Dim nCounter As Short
For nCounter = printers.Items.Count - 1
Do While nCounter > 0
print = print & printers.SelectedItem.Text
nCounter -= 1
loop
 
Back
Top