Menu bar

disabling

Page 1 of 1

11 Replies - 2134 Views - Last Post: 08 April 2009 - 03:23 AM Rate Topic: -----

#1 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Menu bar

Posted 07 April 2009 - 11:42 PM

Hi.
For my program, I want to disable the a menu option (eg. Menu --> Exit) until text has been typed into a textbox. However, i cant achieve this with my code, can anyone help?

Private Sub mnuFileGraph_Click()
If txtInv.text = "" then
mnuFileGraph.enabled = false
Else: 
mnuFileGraph.enabled = true
End If

If mnuFileGraph.enaabled = true then
Form2.Show
End If

End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: Menu bar

#2 Nikhil_07n  Icon User is offline

  • The cheese stands alone..
  • member icon

Reputation: 49
  • View blog
  • Posts: 2,489
  • Joined: 09-January 09

Re: Menu bar

Posted 08 April 2009 - 01:19 AM

what is 'mnuFilegraph'?

details please..
Was This Post Helpful? 0
  • +
  • -

#3 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Menu bar

Posted 08 April 2009 - 01:23 AM

hi dude try this


Private Sub Text1_Change()
	If Text1.Text = "" Then
		mnuMenu.Enabled = False
	Else
		mnuMenu.Enabled = True
	End If
End Sub





regards !
Was This Post Helpful? 0
  • +
  • -

#4 Nikhil_07n  Icon User is offline

  • The cheese stands alone..
  • member icon

Reputation: 49
  • View blog
  • Posts: 2,489
  • Joined: 09-January 09

Re: Menu bar

Posted 08 April 2009 - 01:34 AM

^^

It is true only if the mnuFileGraph is NOT the menu which he's trying to disable.
Was This Post Helpful? 0
  • +
  • -

#5 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Menu bar

Posted 08 April 2009 - 01:49 AM

Quote

Hi.For my program, I want to disable the a menu option (eg. Menu --> Exit) until text has been typed into a textbox. However, i cant achieve this with my code, can anyone help?

from what i understand he wants mnuFileGraph to be disabled until some text is put in textbox so until textbox is empty the menu is disabled
Was This Post Helpful? 0
  • +
  • -

#6 Nikhil_07n  Icon User is offline

  • The cheese stands alone..
  • member icon

Reputation: 49
  • View blog
  • Posts: 2,489
  • Joined: 09-January 09

Re: Menu bar

Posted 08 April 2009 - 01:52 AM

we cannot disable a menu at its own click event..
We can, but for further use...

Not before its Click event has been triggered

This post has been edited by Nikhil_07n: 08 April 2009 - 01:53 AM

Was This Post Helpful? 0
  • +
  • -

#7 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Menu bar

Posted 08 April 2009 - 01:55 AM

yes so do it befor that and check if txt is empty or not :P
Was This Post Helpful? 0
  • +
  • -

#8 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Menu bar

Posted 08 April 2009 - 02:22 AM

mnufilegraph is the sub menu (ie. click File then --> Graph)

@NoBrain:

your code doesnt work. (it just doenst disable the sub menu)
Was This Post Helpful? 0
  • +
  • -

#9 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Menu bar

Posted 08 April 2009 - 02:27 AM

ok...

Just reconfigured the code...
Now i placed it under form _ load and i can get the submenu to be disabled but now i cant get the submenu to enable again even after typing in text into the textbox.
Was This Post Helpful? 0
  • +
  • -

#10 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Menu bar

Posted 08 April 2009 - 02:44 AM

code pls


Private Sub Form_Load()
If Text1.text = "" Then mnuGraphic.Enabled = False
End Sub

Private Sub Text1_Change()
	If Text1.text = "" Then
		mnuGraphic.Enabled = False
	Else
		mnuGraphic.Enabled = True
	End If
End Sub



dude it work on my PC and no mather if it is sub menu or main menu
on any char type in textbox eneble it
if you want i can send you the form and code

This post has been edited by NoBrain: 08 April 2009 - 02:46 AM

Was This Post Helpful? 1
  • +
  • -

#11 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Menu bar

Posted 08 April 2009 - 02:56 AM

It works now. Thanks...
Was This Post Helpful? 0
  • +
  • -

#12 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Menu bar

Posted 08 April 2009 - 03:23 AM

np dude glad that i can help :P
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1