Enabled property

P

Paul Hendrickson

I am writing a word processor using a rich text box. I want to disable
(Grey out) some things on the mainmenu like 'Cut' or 'Copy' when there is no
text selected. Here is what I thought would work:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MenuItemCut.Enabled = False
End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
If RichTextBox1.SelectedText <> "" Then
MenuItemCut.Enabled = True
Else
MenuItemCut.Enabled = False
End If
End Sub


If I changed the 'If' line to:

If RichTextBox1.Text <> "" Then

It disables cut until I load a file. I want cut to be disabled until I
select something. What am I doing wrong here?
I've tried different combinations like setting the cut enabled property to
true or false, etc.

Thanks in advance!

Paul Hendrickson
(e-mail address removed)
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top