473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Select / Deselect Menu Items

This piece of code handles the selection & deselection of
main menu items and serves this purpose well although I'm
not convinced this is the most effective way to do it as
it seems a bit long winded. Perhaps theres a quicker,
easier & shorter method to code this. any suggestions
would be appreciated as always

///
Private Sub DisplayRocketMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) _
Handles DisplayRocketMenuItem.Click

Static tRocketHideShow As Boolean

tRocketHideShow = Not tRocketHideShow

If tRocketHideShow = True Then
Me.DisplayRocketMenuItem.Checked = True
Me.IdRocketLabel.Visible = True
Me.RocketPictureBox.Visible = True
Else
Me.DisplayRocketMenuItem.Checked = False
Me.IdRocketLabel.Visible = False
Me.RocketPictureBox.Visible = False
End If
End Sub

Private Sub DisplayCarsMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) _
Handles DisplayCarsMenuItem.Click

Static tCarsHideShow As Boolean

tCarsHideShow = Not tCarsHideShow

If tCarsHideShow = True Then
Me.DisplayCarsMenuItem.Checked = True
Me.IdCarsLabel.Visible = True
Me.CarsPictureBox.Visible = True
Else
Me.DisplayCarsMenuItem.Checked = False
Me.IdCarsLabel.Visible = False
Me.CarsPictureBox.Visible = False
End If
End Sub
///
Regards Steve...
Nov 20 '05 #1
1 1440
-----Original Message-----
Hi Steve,
I did some changes, I do not know if you mean this.
To answer your question about faster.
You can use a container or a group box.
The fastest way to use that: Just drag them on your form and then drag thecontrols in it.

"> Private Sub DisplayRocketMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) _
Handles DisplayRocketMenuItem.Click

Dim tRocketHideShow As Boolean
tRocketHideShow = Not

me.IdRocketLabel.Visible 'Just for the example Me.DisplayRocketMenuItem.Checked = tRocketHideShow Me.IdRocketLabel.Visible = tRocketHideShow
Me.RocketPictureBox.Visible = tRocketHideShow End Sub


Regards,
Cor

Hi Cor, thanks for that, I never really worded my
original post very well, I was just looking for anyway to
optimise code and your solution appears to do this...

Thanks & Regards Steve
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Keiron Waites | last post by:
Hi, I have two select fields with the multiple attribute so you can see all options. When a user clicks on one form, I would like to deselect anything from the other form. Is there a way to do...
3
by: Gumtree | last post by:
Hi folks, The user interface I'm trying to impliment looks a bit like this: Not Chosen Chosen .------------. .------------. |Item 1 | -> |Item 3 | |Item 2 | <-...
3
by: Notorious | last post by:
The following Javascript line will deselect the currently selected index of a select box for Netscape and Firefox, but will not deselect in Explorer 6. theForm.assignedLic.options.selected =...
1
by: Dale | last post by:
Does anyone know how to select all of the items in a datagrid and then how to deselect all items in a datagrid. Thanks in advance! Dale
4
by: Bill Nguyen | last post by:
I would like to be able to do the following: Listbox1/Textbox1 contains list of all items not selected item A item B item D Listbox2//Textbox2 contains list of all items selected
2
by: ahmad | last post by:
when i used the statment for(var i = 0; i < menu.length; i++) { menu.options.selected = "false"; } to deselect all the options within a list, it surprisingly selected all the options. I tried...
1
by: VBNovice05 | last post by:
I run a search on my database and get items that fit that search in a datagrid. There are checkboxes already for each item. I need to create a select/deselect all checkbox at the top of the...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
2
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.