Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

Listboxs

ok i want to be able put a bunch of tricks(sk8ting) and when i click on one it displays how to do the trick in List2 How Would you do that?
0
AOL1998
Asked:
AOL1998
  • 5
  • 3
1 Solution
 
kamallCommented:
Here is the code:

In the form's general-declarations section:
Dim MyTrick(10) as string
   
    Private Sub List1_Click()
        List2.AddItem MyTrick(List1.ListIndex+1)
    End Sub

         
    Private Sub Form_Load()
        For x = 1 To 10
            List1.AddItem "Trick" & CStr(x)
            MyTrick(x) = "XXX......."   'Put here the trick text
        Next
    End Sub
0
 
kamallCommented:
Note that you must assign a different text for each array elemet. This text is the trick-text for each element of the MyTrick() array. So the line:

MyTrick(x) = "XXX......."   'Put here the trick text

should really looks like:

Select Case x
    Case = 1
        MyTrick(x) = "XXX1......."
    Case = 2
        MyTrick(x) = "XXX2......."
    ......
End Select
0
 
AOL1998Author Commented:
It Keeped Puting down When i clicked on a trick The trick text i put But i Want to make it so that you can click on Mutiple Tricks like you click on ollie and it shows you howto do a ollie and a kick flip stuff like that seprite Text in the list2 for seprite Tricks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AOL1998Author Commented:
Sorry You Got It I Messed Up  i didnt look at the comment
Sorry Just Write in anything and ill grade you exellent
:( Sorry
0
 
jonderCommented:
1      Dim MyTrick(10) As String
2          
3          Private Sub List1_Click()
4             List2.AddItem MyTrick(List1.ListIndex + 1)
5          End Sub
6
7                
8          Private Sub Form_Load()
9              For x = 1 To 10
10                 List1.AddItem "Trick" & CStr(x)
11                 MyTrick(x) = "XXX......." & CStr(x)  'Put here the trick text
12             Next
13          End Sub


You had your code right you just forgot about   ' & CStr(x) '  in line 11

So what every trick you click on in the List1 box ie,   Trick  XXX.......1
In the second box it would display XXX........1
0
 
kamallCommented:
jonder,
Why did you post an answer???
Didn't you read AOL1998's last comment?

AOL1998,
Please reject jonder's answer so I can post the answer and get the points.

Thanks.
0
 
kamallCommented:
AOL1998,
Please come in and reject the proposed answer to enable me to lock the question and get the points because otherwise jonder will automatically get the points after some time.
Thanks
0
 
AOL1998Author Commented:
Kamall Help Me

0
 
kamallCommented:
Thanks AOL1998, and sorry for the delay.
I am reposting my answer.
Tell me what is your problem.

In the form's general-declarations section:
      Dim MyTrick(10) as string
           
          Private Sub List1_Click()
              List2.AddItem MyTrick(List1.ListIndex+1)
          End Sub

               
          Private Sub Form_Load()
              For x = 1 To 10
                  List1.AddItem "Trick" & CStr(x)
                  MyTrick(x) = "XXX......."   'Put here the trick text
              Next
          End Sub

Note that you must assign a different text for each array elemet. This text is the trick-text for each element
      of the MyTrick() array. So the line:

      MyTrick(x) = "XXX......."   'Put here the trick text

      should really looks like:

      Select Case x
          Case = 1
              MyTrick(x) = "XXX1......."
          Case = 2
              MyTrick(x) = "XXX2......."
          ......
      End Select

Regards.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now