Solved

Listboxs

Posted on 1998-08-17
9
135 Views
Last Modified: 2010-04-30
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
Comment
Question by:AOL1998
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 7

Expert Comment

by:kamall
ID: 1429431
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
 
LVL 7

Expert Comment

by:kamall
ID: 1429432
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
 

Author Comment

by:AOL1998
ID: 1429433
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:AOL1998
ID: 1429434
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
 
LVL 1

Expert Comment

by:jonder
ID: 1429435
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
 
LVL 7

Expert Comment

by:kamall
ID: 1429436
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
 
LVL 7

Expert Comment

by:kamall
ID: 1429437
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
 

Author Comment

by:AOL1998
ID: 1429438
Kamall Help Me

0
 
LVL 7

Accepted Solution

by:
kamall earned 50 total points
ID: 1429439
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question