Solved

shortcut

Posted on 1998-12-05
11
207 Views
Last Modified: 2010-05-03
I have several listboxes but i want to show only one of them at a time. I used the following code. Though it worked fine but it is very lengthy.If anybody could tell me any shortcut?

If Node.Index = 13 Then
  List1.Visible = False
  List2.Visible = False
  List3.Visible = True
  List4.Visible = False
  List5.Visible = False
 
ElseIf Node.Index = 14 Then
 List1.Visible = False
  List2.Visible = False
  List3.Visible = False
  List4.Visible = True
  List5.Visible = False
 
 Elseif ...... and so on
0
Comment
Question by:mailsuhail
  • 5
  • 2
  • 2
  • +1
11 Comments
 

Author Comment

by:mailsuhail
ID: 1448398
Edited text of question
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1448399
Define your list boxes as a CONTROL ARRAY. Then you'll have:

FOR Ndx = 1 to Number_of_controls
 IF Ndx = Desired_number THEN
    List1(Ndx).Visible = True
 ELSE
    List1(Ndx).Visible = False
 ENDIF
NEXT Ndx
0
 

Author Comment

by:mailsuhail
ID: 1448400
I have 6 list boxes. the above code only hides the selected one but the rest of them were still visible.what i need is that only one of them should be visible at one time. thanks
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:mailsuhail
ID: 1448401
I have 5 list boxes. the above code only hides the selected one but the rest of them were still visible.what i need is that only one of them should be visible at one time. thanks.



    If list1.listindex =1 Then
      List1.Visible = False
      List2.Visible = False
      List3.Visible = True
      List4.Visible = False
      List5.Visible = False
       
    ElseIf list1.listindex = 2 Then
     List1.Visible = False
      List2.Visible = False
      List3.Visible = False
      List4.Visible = True
      List5.Visible = False
       
     Elseif ...... and so on





0
 

Author Comment

by:mailsuhail
ID: 1448402
I have 5 list boxes. the above code only hides the selected one but the rest of them were still visible.what i need is that only one of them should be visible at one time. thanks.



    If list1.listindex =1 Then
      List1.Visible = False
      List2.Visible = False
      List3.Visible = True
      List4.Visible = False
      List5.Visible = False
       
    ElseIf list1.listindex = 2 Then
     List1.Visible = False
      List2.Visible = False
      List3.Visible = False
      List4.Visible = True
      List5.Visible = False
       
     Elseif ...... and so on





0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1448403
Q why did you reject mailsuhail answer ??? It should work ...


0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1448404
Q why did you reject mailsuhail answer ??? It should work ...


0
 
LVL 7

Accepted Solution

by:
Inteqam earned 10 total points
ID: 1448405
if i understood you Q,
try this:

list1.visible=false
list2.visible=false
list3.visible=false
list4.visible=false
list5.visible=false

if list1.listindex =1 then
    list3.visible=true
elseif list1.listindex =2 then
    list4.visible=true
elseif....... and so on.
 
or use a case statemenet as follow

list1.visible=false
list2.visible=false
list3.visible=false
list4.visible=false
list5.visible=false

select case list1.listindex
 case 1:
    list3.visible=true
case 2:
    list4.visible=true
case 3 :
..... and so on.
end select


hope you the best

0
 

Author Comment

by:mailsuhail
ID: 1448406
thank you
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1448407
My answer worked as well.

M

0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1448408
sorry mark2150 , i didn't see your answer ,but i think it works.

what can i do?

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

778 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