Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #21 (permalink)  
Old December 27th, 2014, 06:14 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default color test

I know this is an old issue but this is how I handled it. On logon I retrieve the users access type from a table and open my next form. when the form loads button colors are set to disable the use of buttons that the user does not have access to. then when they click the button i test for the disabled color and if the button has that color set it simply exits the sub. In doing it this way the hover colors etc still work, but when clicked on it simply does nothing.

'Form Load event
Private Sub Form_Load()
Dim rs As Recordset
Dim lngLGrey As Long, lngDGrey As Long
lngLGrey = RGB(120, 120, 120)
lngDGrey = RGB(60, 60, 60)
Set rs = CurrentDb.OpenRecordset("Users", dbOpenSnapshot, dbReadOnly)

rs.FindFirst "UserName='" & LCase(Environ$("UserName")) & "'"

Select Case rs!UserType
Case 1

Me.btnReg.ForeColor = lngLGrey
Me.btnReg.BackColor = lngDGrey

Me.btnAdmin.ForeColor = lngLGrey
Me.btnAdmin.BackColor = lngDGrey

Case 2

Me.btnInstructor.ForeColor = lngLGrey
Me.btnInstructor.BackColor = lngDGrey

Me.btnAdmin.ForeColor = lngLGrey
Me.btnAdmin.BackColor = lngDGrey

Case 3

Me.btnAdmin.ForeColor = lngLGrey
Me.btnAdmin.BackColor = lngDGrey

Case 4


Case Else

Me.btnInstructor.ForeColor = lngLGrey
Me.btnInstructor.BackColor = lngDGrey

Me.btnReg.ForeColor = lngLGrey
Me.btnReg.BackColor = lngDGrey

Me.btnAdmin.ForeColor = lngLGrey
Me.btnAdmin.BackColor = lngDGrey
GoTo Invalid
End Select
Exit Sub
Invalid:
Dim LResponse As Integer
LResponse = MsgBox("Invalid UserType", vbOKOnly, "Invalid Access")

End Sub

'button click event
Private Sub btnAdmin_Click()
If Me.btnReg.ForeColor = RGB(120, 120, 120) Then Exit Sub
DoCmd.OpenForm "Admin"
End Sub
Reply With Quote
Reply


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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
re: color change jack_in_black ASP.NET 2.0 Professional 0 July 11th, 2006 07:24 AM
TD Color Change echovue Javascript How-To 1 March 3rd, 2006 02:40 AM
how to change all control color ashish2001mca .NET Framework 2.0 1 February 22nd, 2005 11:47 PM
change background color of toolbar control myth12345 VB How-To 1 January 5th, 2005 11:25 PM
Color change possability? rolandatem VB How-To 2 November 19th, 2004 02:52 PM



All times are GMT -4. The time now is 01:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.