enable forms/buttons using VB
I know this may sound amatuer and silly to some but I need some help. I have a gentleman that helps me from time to time and is teachign me Vb at work but I'm working on a project at home and cant contact him. Please help me.
I want to create a database control form that will enable or disable different forms or buttons etc in my database. I plan on trying to install this in multiple locations and some need some controls others dont. So any controls or forms that arent needed can be hidden by simply selecting a check box to enable and deselect to hide it.
Lets use a small example:
Main menu: 3 buttons
1st is a IN button opening the In form
2nd is an Out button opening an out button
3rd being an control form (this is where things would eb enabled or disabled)
If I added two check boxes to the Control Form one name In and one named Out and if they are checked then on the main menu they would be visible, if they are unchecked they would not be visible.
Can someone help me with this code please I can see it in my head but cant get it right.
I know it would be I think...
IN = true then
I don't understand what you mean when you say the buttons will "enable or disable different forms or buttons etc in my database." Databases don't have forms or buttons; they have data, tables, and fields...
If I understand your question, you will have multiple forms in your application, and one form will control the visibility of the controls in the other form?
If that is what you want, you just need to reference the buttons on the other form in the Click() event of the checkbox on your control form.
So if form1 is the name of the form you will control, then, on the "Control Form", in VB (I am assuming this is VB.NET), double-click the checkbox. That will open the code window, and will create the code to handle the click event. It will look like this, if we name the checkbox "CheckBoxIN":
In between the 2 lines, you would do something like this:
Private Sub CheckBoxIN_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles CheckBoxIN.CheckedChanged
(assuming the button on form1 is named "cmdIN")
Or, even better and shorter, do this:
If CheckBoxIN.Checked = True Then
form1.cmdIN.Visible = True
form1.cmdIN.Visible = False
form1.cmdIN.Visible = CheckBoxIN.Checked
That should take care of it.
Last Post: 06-06-2008, 04:39 AM
By Jeff Johnson in forum .NET
Last Post: 01-18-2007, 07:44 AM
By Glen Kunene in forum Talk to the Editors
Last Post: 03-23-2002, 12:43 AM
Last Post: 09-07-2001, 05:55 PM
By Allison Boughton in forum VB Classic
Last Post: 03-05-2001, 12:27 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL