Solved

Listboxs

Posted on 1998-08-17
9
132 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now