Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Menu problems


Menu problems

Reply
  #1 (permalink)  
Old 07-19-06, 07:59 PM
needforhelp needforhelp is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Menu problems

Hello,
I'm currently experiencing a quite annoying problem.
I've made a small code which is adding some items to a standard VB menu when program is running (From a list box).
Code is as follow :
Code:
dim w,x as integer
    While w < list1.ListCount
    w = w + 1
    
   Load menu(w)
    x = w - 1
    menu(w).Caption = list1.List(x)
    Wend
Everything is working fine except for 1 thing :
I want just the currrently selected item to be checked.
I've wrote the following code in the menu :
Code:
Private Sub menu_Click(Index As Integer)
menu(Index).Checked = True
end sub
It's checking the currently selected item but not un-checking the previous item.
Is there some way to uncheck all the previous items?
Thanks in advance!
All the best,
Need for Help!

Last edited by needforhelp; 07-19-06 at 08:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-22-06, 03:00 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
You mean something like:

Code:
menu(Index - 1).Checked = False
...
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-15-06, 08:06 AM
Keithuk's Avatar
Keithuk Keithuk is offline
Newbie Coder
 
Join Date: Sep 2004
Location: Staffordshire, England
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Well because its a control array you can use a For/Next loop to remove all check marks then just check the selected Index.
Code:
Private Sub menu_Click(Index As Integer)

Dim N As Integer

'Find the Lower and Upper Index value
For N = LBound(menu) To UBound(menu)
     menu(N).Checked = False
Next
menu(Index).Checked = True

End sub
I don't have VB on my comp at work so I can't try it. Providing LBound and UBound return values it should work.
__________________
I've been programming with VB for 13 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

http://www.martin2k.co.uk/forums/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Collapsable Menu - HELP salvo HTML/XHTML/XML 1 08-16-06 05:12 AM
Menu problems... dflies CSS 2 10-21-05 02:16 PM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 09:05 AM
Right Click Menu dwoody JavaScript 1 10-15-04 10:11 AM
Simple tree menu w/ html and js? zcorpan JavaScript 2 06-18-04 07:17 PM


All times are GMT -5. The time now is 10:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.