473,396 Members | 1,893 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,396 software developers and data experts.

Dynamic MDI Menus?

I am developing an MDI database access app that will be used by people
with varying access rights. Is it possible to make menu items show or
be hidden based upon the authority of the user? BTW...the user's
access level is stored in the db and stored as a public variable upon
successful authentication.
Nov 20 '05 #1
4 1562
* Matthew Speed <ms****@mspeed.net> scripsit:
I am developing an MDI database access app that will be used by people
with varying access rights. Is it possible to make menu items show or
be hidden based upon the authority of the user? BTW...the user's
access level is stored in the db and stored as a public variable upon
successful authentication.


Yes, thia can be done. What's the problem?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #2
On 29 Feb 2004 14:11:30 +0100, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Matthew Speed <ms****@mspeed.net> scripsit:
I am developing an MDI database access app that will be used by people
with varying access rights. Is it possible to make menu items show or
be hidden based upon the authority of the user? BTW...the user's
access level is stored in the db and stored as a public variable upon
successful authentication.


Yes, thia can be done. What's the problem?


Okay, I have the MDI app set up. The first thing it does it open a
child window that asks the user for a login/password. In my _Load sub
for the MDI parent I have me.menu = nothing so that no menu will show.

I check against the DB. If they authenticate correctly I close the
login form and give control to the main MDI form. At this point I
want the menu to show. Additionally, the permissions for various
groups of people overlap so what people have access to varies.
Additionally, I would like to make it so that people who don't have
access to something don't even know that a particular action exists.
Nov 20 '05 #3
Hi Matthew,

Thanks for posting in the community.

From your description, you wants to know how to enable the menu item based
on the user.

The code line below will tell you who is the current logon user.
System.Security.Principal.WindowsIdentity.GetCurre nt().Name
Also you can show a form to let the user login into, and you can
authenticated what access level the user will get and then show the MDI
Menu, by generating its menu item dynamically.

Here is some example for dynamically generating the menu.
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformsmenuclassgetmainmenutopic.a sp
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Hi Matthew,
After reading your second reply, I think a dynamical MainMenu will be a
solution.
In the Form_Load event if MDI form, you can hide the menu item so that it
will not be found.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create the MainMenu and the menu items to add.
Dim mainMenu1 As New MainMenu

Dim menuItem1 As New MenuItem
Dim menuItem2 As New MenuItem

Dim subMenuItem1 As New MenuItem

' Set the caption for the menu items.
menuItem1.Text = "File"
menuItem2.Text = "Edit"

'Add an subMenuItem and add its event handler
subMenuItem1.Text = "Test"
AddHandler subMenuItem1.Click, AddressOf m_Click
' Add 3 menu items to the MainMenu for displaying.
mainMenu1.MenuItems.Add(menuItem1)
mainMenu1.MenuItems.Add(menuItem2)

menuItem1.MenuItems.Add(subMenuItem1)

' Assign mainMenu1 to the form.
Menu = mainMenu1

'So that the sencond menu item will not found in the menu bar.
Menu.MenuItems(1).Visible = False
End Sub

Private Sub m_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MsgBox("hello")
End Sub
If you have any concern on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #5

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

Similar topics

1
by: Andrea Bampi | last post by:
I'm just trying to do my first experiments with js, but I need some good examples to start with.. I need to design a dynamic form with two dropdown menus picking their select values from a db: my...
1
by: Colvin | last post by:
I'm trying to create a pair of dynamic drop-down menus. I'm new to Javascript, so I tried to find a simple example on the web. I found a good example at...
3
by: Eddie de Bear | last post by:
Hi, A project I am working on has a requirement for dynamic menus. For the most part this works really well. The menus I'm creating a based on files and directories, so naturally the menu...
0
by: JMMB | last post by:
Just couldn't find any article in MSDN about dynamic menus. I know i can create menus dynamically in run time using the information from a database combined with System.Refletion, but didn't find...
3
by: Stan Smith | last post by:
Is there a way to create dynamic menus and create dynamic events associated with those menus? I would like to create a menu system based on the contents of a text file. When the menu item is...
2
by: Ron M. Newman | last post by:
Hi, Just need a little advice. Id like to build *dynamic* context menus for tree nodes. I'm pretty versed in building context menus and attaching them to tree nodes. My question is, what...
2
by: rpeterson84 | last post by:
Hello: I was hoping to gain some insight, a point in the right direction if you will... We use an .asp web page to select from a couple of dynamic drop down menus then enter a number, and press...
3
by: EnigmaticSource | last post by:
Currently, I am designing a site using CSS driven vertical menus, it works well in everything but MSIE. The menus seem to work well enough, except that they float behind the images, but above the...
0
by: cwhiteau | last post by:
I am trying to create dynamic menus using menu items loaded in a SQL server table. I need to be able to add/delete menu items on the back end (on the server)rather than be hard coded inside VB. The...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.