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)
(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)