Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Listboxs

Posted on 1998-08-17
9
Medium Priority
?
136 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 100 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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

730 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