|
-
Dec 10th, 1999, 03:32 AM
#1
Thread Starter
Addicted Member
How would I make a textbox = list1's 3rd selection? For example, when a button is pressed, the 3rd value, or 3rd item from the top(not sure what to call it), pops into the textbox, i have a good idea on what to do, but nothing will work, please help, thanx
-
Dec 10th, 1999, 03:47 AM
#2
Fanatic Member
Try this:
Add a ListBox, CommandButton and TextBox to your form, then paste this code:
Code:
Option Explicit
Public Index As Integer
Private Sub Command1_Click()
Text1.Text = List1.List(Index)
End Sub
Private Sub Form_Load()
Dim I As Integer
With List1
For I = 1 To 10
.AddItem I
Next I
End With
End Sub
Private Sub List1_Click()
Index = List1.ListIndex
End Sub
I hope this will help
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
-
Dec 10th, 1999, 03:54 AM
#3
Do you mean how do you access the 3rd Item Down from the Visible Top of the Listbox?
Code:
Private Sub Command1_Click()
If List1.TopIndex + 2 < List1.ListCount Then
Text1 = List1.List(List1.TopIndex + 2)
Else
Text1 = List1.List(List1.ListCount - 1)
End If
End Sub
Otherwise, if you mean how do you access the 3rd Item Period..
Text1 = List1.List(2)
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Dec 10th, 1999, 04:02 AM
#4
Thread Starter
Addicted Member
Im a little confused, what you gave me, even though i appreciate your help, was not what i was looking for, maybe if im more specific:
Say i have 10 items in the listbox. I also have 10 textboxes. What would i do, so at a push of a button, the each listbox item, is now in a seprate textbox.
-
Dec 10th, 1999, 04:05 AM
#5
Thread Starter
Addicted Member
Thanks aaron, thats what ive been looking for
-
Dec 10th, 1999, 04:06 AM
#6
Fanatic Member
If that's your problem then use this:
Create an array of 10 textboxes, add 10 items to a listbox and paste this code:
Code:
Private Sub Command1_Click()
Dim I As Integer
For I = 0 to List1.ListCount - 1
Text1(I).Text = List1.List(I)
Next I
End Sub
Hope This will help
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
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
|