I need to know if the visible property of a control is set to TRUE - vb.net-2010

I have a desktop app with TabControls and many tabs inside of them.
Inside every tab there's many controls and I'm hiding some of them by setting their visible property to FALSE depending on the configuration the user choose.
Now I need to know what controls has their visible property set it to TRUE but the control return FALSE if another tab is selected because is not visible to the user, which is true, but I need to know if will be visible if the user select the tab that contains that control.
Also I need to do this from a sub that is called from a BackgroundWorker.
Any workaround this?

Related

Having trouble setting DevExpress CheckEdit.EditValue to True. EditValue remains as Nothing even when assigning a value

I have an Xtra Tab Control which contains 6 tab pages. On each of these tab pages lives a User Control which contains a Check Edit on a Binding Navigator that I want to default to checked when creating the form as shown below (worth noting that I am using a library for the Binding Navigator and this code cannot be changed):
To do this I thought I'd be fine putting the code in the Initialise method of the User Control so when creating the User Control for each of these tabs I'd be able to set the EditValue to True but unfortunately even when assigning the EditValue to True the EditValue just remains as Nothing (Indeterminate)
I've managed to get the check edit on the first User Control to set by default by using the UserControl_Loaded event, however, for the other 5 tabs the value is not checked as the Loaded event hasn't fired for these yet until the tab is selected.
Any help is appreciated.
Loop through the tabpages to load them

Enable Controls within disabled Panel in VB.Net

I have some Controls inside a Panel inside a Form. I want to disable the Panel but some Controls inside the panel need to stay enabled.
Is there any way to enable some Controls inside a disabled Panel?
I would be happy about some ideas how to do that.
One of the benefits of Panels is the can used to provide logical grouping with little or no visual element (compared to a Groupbox which is both logical AND visual). Given your question, perhaps all the child controls do not actually belong in the same container (logical group). You could use 2 or 3 panels to solve the container/child enabling problem and use the BorderStyle and BackColor properties to make them look like they are all one panel (perhaps on a master panel whose sole role is to position the children).
You can also "cascade" enabling to logically dependent elements from events. For instance, consider a checkbox "Absolute Position" which controls whether or not other controls (X Pos, Y Pos) are enabled. X and Y's enabled state can be toggled from events on chkAbsPosition such as CheckChanged and EnabledChanged.
Depending on your form, you might be able to toggle 2 or 3 controls and let each of them in turn set the state for dependent elements.
HTH
The panel is a container and its enabled property will supersede its child ones. So you have to enable the panel in order to be able to enable the controls.
What you could possibly do is not put the controls in the panel, but on top of it, and enable disable accordingly. That way they will look like they are in the panel when they are not.
I have a good solution for it.
Unless you really want to disable your panel, just create 2 functions:
Function disablePanel()
For Each element In yourForm.yourPanel.controls
element.enabled = False
Next
Return Nothing
End Function
Function enablePanel()
For Each element In yourForm.yourPanel.controls
element.enabled = true
Next
Return Nothing
End Function
thanks to it, you have all of your component in your panel disable, but not your panel. So you can still do whatever you want on your panel, or not disable a wanted control : )
cheers.

Access forms and sub-forms

I am building a database on MS 2003. I have one form which calls for a series of options. This form is based on the table "Categories" which is linked to the main table by Customer ID.
Now, both forms appear together on the same screen, what I am trying to do is have the person select one or more of the categories and in pressing a command button then those categories which were selected will show its respective forms. The forms are invisible until selected and until the command button is pressed.
Since they are two different forms (categories in one) and the entry form on another, How do I program the command button to make the entry form visible FROM the other form?
The sub-form is located in a tab. I dont want to show it as a pop-up but to become visible within the tab where it's located
If the form is open but invisible then you can refer to it as a member of the forms collection and make it visible:
forms("myForm").Visible = true
If the form isn't open then get its name from the AllForms collection of the project and then use the OpenForm method:
docmd.OpenForm currentproject.AllForms("myForm").Name, acNormal
Pseudologic: you are basically going to want to set the Visible property with all of your forms to False during the form's Open event. You should place this Visible = False code in a separate subroutine so that the code structure can be called during other events too. (For example you may want to provide a Reset button so that the user can reset the form, or trigger the "set false" code when a new customer id is selected.) Then with every selected category you would set its associated form property visible by setting Visible = True.

vb.net: Why all contained controls within a groupbox do NOT respond to Enabling/disabling?

I'm working on a winform which contains several controls like textboxes, radio buttons, datagridviews... All of these controls have been added to a main group box called gbDataEntry.
My problem is when the user is seeing the form, I set gbDataEntry.Enabled = False but I want to enable some controls like DataGridviews so the user can scroll them. After disabling gbDataGridview I set DataGridView1.Enabled = True but it seems that the datagridview does not respond to this line. Why?
Is anything wrong with it?
This is standard .NET behaviour (as mentioned in the comment): if a container is disabled then all controls it contains are disabled and cannot be enabled separrately:
When a container control has its enabled property set to false, all its contained controls are disabled, as well. For example, if the user clicks on any of the controls contained in a disabled GroupBox control, no events are raised.
(from Control.Enabled Property on MSDN)
Why do you want to implement this in such a way? The messy solution to this is to enable/disable controls individually.

How to repaint a Word 2003 menubar

I have a Word 2003 .dot template that changes its menu based on the condition of the active document.
The DocumentChange, DocumentOpen and NewDocument events of Word.Application trigger setting the .Visible and .Enabled properties of CommandBarButton controls.
On switching active documents, controls exposed by changing the Visible property display correctly, but text buttons which have been enabled/disabled do not change appearance. You can show enabled controls by hovering over them, but the disabled ones do not repaint until you place a window in front.
Is there a simple way to send a repaint message to the menubar, to simulate hiding and exposing?
You are playing with the visible & enabled properties of the controls. But did you try to hide/unhide the whole commandbar to refresh it?
application.CommandBars.ActiveMenuBar.visible = false
application.CommandBars.ActiveMenuBar.visible = true