pruebens Posted January 2, 2003 Posted January 2, 2003 I'm missing a namespace that I hope someone can point out for me. What I'm 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 isn't 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 can't think of one that I'm missing. Thanks to anyone that can help me out Quote
pruebens Posted January 2, 2003 Author Posted January 2, 2003 (edited) 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: 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 I'm 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. I'm obviously missing something and I hope someone can help me fix this Edited January 2, 2003 by pruebens Quote
aikeith Posted January 23, 2003 Posted January 23, 2003 Dim nCounter As Short For nCounter = printers.Items.Count - 1 Do While nCounter > 0 print = print & printers.SelectedItem.Text nCounter -= 1 loop Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.