biazer911 10-04-2001, 04:00 PM I have three listboxes that I need to aquire information from and I am totally stuck on how to do it.
coding all day has fried my brain stem .......think I am going to donate it to science when I am done
Squirm 10-04-2001, 04:02 PM <pre>Debug.Print Listbox1.List(4)
Debug.Print Listbox2.List(7)
Debug.Print Listbox3.List(21)</pre>
and so on........
biazer911 10-04-2001, 04:16 PM thank you so much
That is twice that I can remember that you have aided me there Squirm
ChiefRedBull 10-04-2001, 04:16 PM Just to elaborate on Squirms post....
<pre><font color=red>Public Sub Extract()
Dim i As Integer
Dim sInfo() As String
For i = 0 to List1.ListCount - 1
sInfo(i) = List1.List(i)
MsgBox sInfo(i)
Next i
End Sub</pre></font color=red>Whack it in a loop to read the entire <font color=red>ListBox</font color=red> into an array.
Chief
"How are we to learn, if those that know will not teach... ?" - Me.
Squirm 10-04-2001, 04:26 PM Only too happy to oblige. Once you reach a certain point you learn the basic ways of VB so that when you run into errors or difficulty you can sort your own problems out, because you have ideas about what kinds of things might be causing the problem, and where to look for the solution. Of course, even the top people here like Billsoo ask the odd question, and it is good to ask them 'publicly' so that others may also learn something which they otherwise would have not found out.
We must ask the questions nobody has thought of yet....
biazer911 10-04-2001, 04:49 PM ok now to throw you both for a loop I need the information to show on a second form........
debug.print form1.listbox1.listindex
this code does not do it I have tried
KesleyK 10-04-2001, 04:51 PM Debug.Print prints the information after the command to the Immediate window at the bottom (if you have it enabled/visible). To assign that same information you would set the string to the labels caption:
Form1.Label1.Caption = "your information here"
__________
HOOOaaaaa! Semper Fi!
biazer911 10-04-2001, 04:52 PM it needs to go into a textbox on the second form
KesleyK 10-04-2001, 04:53 PM Form2.TextBox.Text = "information here"
Unless this isn't what you're asking for, and if this doesn't help I'm confused...
__________
HOOOaaaaa! Semper Fi!
ChiefRedBull 10-04-2001, 04:55 PM You could also have a var declared on the second form (or in a module), like this:
<pre><font color=red>Public sInfoString As String</pre></font color=red>
And then reference it in the loop like this:
<pre><font color=red>Form2.sInfoString = List1.List(5)</pre></font color=red>
Chief
"How are we to learn, if those that know will not teach... ?" - Me.
biazer911 10-04-2001, 04:58 PM ok let me see if i have this right now
debug.print listbox1.list(2) = form2.text1.text
KesleyK 10-04-2001, 05:00 PM No, sorry. Return question, do you know how to programmatically set the Text Property of a TextBox, the Caption Property of a Label or Form or evaluate the List item in a ListBox?
If not, we need to start there before we can answer your question I think.
__________
HOOOaaaaa! Semper Fi!
Squirm 10-04-2001, 05:00 PM NO! Don't use Debug.Print
biazer911 10-04-2001, 05:06 PM ok I can get the textboxes to print out to the second form and I can get the checkboxes to show up there also I can do most of the programming it is the listboxes that I forget how to get to set to show on the second form.
one list box has 17 items the other has only three but I need to be able to pull the infomation from both of them and have it show on the second form in a textbox that can be copied and pasted into a second application....
unless you can help me to setup telnet inside of a form inside of my application and have the forms pass the infomation into the telnet session
KesleyK 10-04-2001, 05:09 PM Well, since you know how to assign text to a TextBox on a separate Form, then all you should need to know is:
formnamehere.listboxnamehere.list(item#youwanthere)
which is a text string (I assume). From there, you can treat it as you would your text from/to a TextBox or Caption of a Label.
__________
HOOOaaaaa! Semper Fi!
biazer911 10-04-2001, 05:39 PM that is exactly what I am looking for but i need to only show the item the user picks from the listbox in the textbox
Volte 10-04-2001, 05:41 PM then for example, if Form2 was the Destination and Form1 was the source,
Form2.Text1.Text = Form1.List1.List(Form1.List1.ListIndex)
|