|
-
Sep 3rd, 2011, 10:28 AM
#1
Thread Starter
Addicted Member
Rich Text Box Spell Check
hi
got the following code from microsoft online thing...
Code:
Imports System
Imports System.Windows
Imports System.Windows.Controls
Namespace SDKSample
Partial Public Class SpellCheckExample
Inherits Page
Public Sub New()
Dim myStackPanel As New StackPanel()
'Create TextBox
Dim myTextBox As New TextBox()
myTextBox.Width = 200
' Enable spellchecking on the TextBox.
myTextBox.SpellCheck.IsEnabled = True
' Alternatively, the SetIsEnabled method could be used
' to enable or disable spell checking like this:
' SpellCheck.SetIsEnabled(myTextBox, True)
myStackPanel.Children.Add(myTextBox)
Me.Content = myStackPanel
End Sub
End Class
End Namespace
however, i'm getting the error "Namespace' statements can occur only at file or namespace level."
not sure what im doing wrong...can't work out where the namespace statement should be placed...thanks in advance
-
Sep 4th, 2011, 12:54 AM
#2
Re: Rich Text Box Spell Check
Where have you put that code? Is it on its own in its own code file or did you paste into some existing code?
-
Sep 4th, 2011, 12:55 AM
#3
Re: Rich Text Box Spell Check
By the way, that code is for WPF, not Windows Forms. Are you using WPF?
-
Sep 4th, 2011, 03:06 AM
#4
Thread Starter
Addicted Member
Re: Rich Text Box Spell Check
Aw man! I'm using vb. I'm sure I got that on the vb section of Microsoft online.
Trying to get the red underline on misspelt words in my rich text box...any advice?
-
Sep 4th, 2011, 04:07 AM
#5
Re: Rich Text Box Spell Check
Sure, I have some advice: answer the questions I asked.
I didn't say that that wasn't VB code. It is VB code. What I said was that it is for WPF rather than Windows Forms. VB is a programming language. WPF and Windows Forms are technologies. When you created your VB project, you'd have selected a project type. If you chose Windows Forms Application then that code is useless to you. If you chose WPF Application then that code is applicable.
-
Sep 4th, 2011, 04:22 AM
#6
Thread Starter
Addicted Member
Re: Rich Text Box Spell Check
Sorry, quite new to this - just learning, I hope that's ok.
So, it's a windows form application I'm creating.
I had pasted that code under public class, with the three "imports" lines before the public class - although this info may be irrelevant now seeing as this code won't work with windows forms :S
Thanks for your help, I appreciate it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|