473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1573
* 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.Wind owsIdentity.Get Current().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/
frlrfsystemwind owsformsmenucla ssgetmainmenuto pic.asp
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) 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.Te xt = "Test"
AddHandler subMenuItem1.Cl ick, AddressOf m_Click
' Add 3 menu items to the MainMenu for displaying.
mainMenu1.MenuI tems.Add(menuIt em1)
mainMenu1.MenuI tems.Add(menuIt em2)

menuItem1.MenuI tems.Add(subMen uItem1)

' 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.EventArg s)
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
2547
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 problem is, how can I make the selection in the first menu affect the value list in the second, without using any buttons? I mean, you just have to...
1
1603
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 http://javascript.about.com/library/weekly/aa072903a.htm , and I tried to model my problem after that. My attempt can be viewed at...
3
4760
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 creation takes some time. The approach I took was to override the OnSelect method of the MenuItem class, which had code to populate the
0
972
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 any real example. does anyone know where i could find it? thanks a lot.
3
1832
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 selected it will execute a routine whose name will also appear in the text file. Thanks. Stan Stan Smith
2
3439
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 event to I "capture" in order to build the tree node menu in real time? right click on a tree node? or is it too late? just FYI: the menu is different...
2
2309
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 go to query the sql db. Is it possible to use a javascript to open the web page, and the select the options I want from a dynamic dropdown...
3
2616
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 text. The problem does not occur in Firefox, Konqueror, or Opera. I'm a bit lost for what the cause could be. Demonstration URL:...
0
1286
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 client installs are all overseas and need to be changed occasionally. I have figured basic dyamic menus inside VB but this doesn't help me solve the...
0
7614
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.