Solved

Listboxs

Posted on 1998-08-17
9
130 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:AOL1998
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Expert Comment

by:jonder
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Kamall Help Me

0
 
LVL 7

Accepted Solution

by:
kamall earned 50 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 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

10 Experts available now in Live!

Get 1:1 Help Now