Enable/Disable buttons

  • Thread starter Thread starter inadsad
  • Start date Start date
I

inadsad

Good Day,
I have 2 forms with bindingNavigator and have a simple routine
to enable/disable navigator buttons. Each
nav button is assigned to a tag value. The problem is that if I
want to enable/disable multiple nav buttons
I have to call the routine twice.

EnableDisableNavBtn(NavMain, NavMain.Item(1), false)
EnableDisableNavBtn(NavMain, NavMain.Item(2), false)
...
Public Sub EnableDisableNavBtn(Byval obj as Object, Byval
MenuItem as ToolStripitem, bflag as boolean...)

if typeof Obj is bindingNavigator then...
if MenuItem.tag = 0 then
MenuItem .Enabled = bFlag
Elseif MenuItem.tag = 1 then
MenuItem .Enabled = bFlag
Elseif MenuItem.tag = 2 then
MenuItem .Enabled = bFlag ...
End sub

I would like to do it in one shot meaning:
EnableDisableNavBtn(NavMain, NavMain.Item(1,2), false)

Could someone please give me an example. Thanks for the advice.
Ian
 
Good Day,
I have 2 forms with bindingNavigator and have a simple routine
to enable/disable navigator buttons. Each
nav button is assigned to a tag value. The problem is that if I
want to enable/disable multiple nav buttons
I have to call the routine twice.

Ian,
Try the following:

NavMain.Items(0).Enabled = bFlag
NavMain.Items(1).Enabled = bFlag
....
Where bFlag is your boolean (T/F).

hth.

Wan
 
Back
Top