-
I am new to VB Programming. I created a little Notepad like application. But I can't add the "WordWrap" functionality of the windows notepad to it. The textbox wordwraps when its scrollbars property is set to vertical. And it doesn't wordwrap when it's set to both. BUT, when I go to change this property at run time(on mnuEditWordWrap_Click event), a compile-error occurs "Can't assign to readonly property". What can I do now?
-
It may appear like Notepad disables and enables Scrollbar's but in reality, it uses 2 different TextBoxes. When you set WordWrap to True, it makes one TextBox visible and the other invisible and vise versa.
Code:
Private Sub mnuWordWrap_Click()
mnuWordWrap.Checked = Not mnuWordWrap.Checked
If mnuWordWrap.Checked = True Then
'If it's checked then make the WordWrap TextBox visible
TextWordWrap.Visible = True
TextNoWordWrap.Visible = False
Else
'If not then make the other one visible
TextWordWrap.Visible = False
TextNoWordWrap.Visible = True
End If
End Sub