Enable/Disable buttons

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
 
W

Wan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top