Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to change an existing console application into a service dll Pin
Giorgi Dalakishvili6-Apr-08 7:57
mentorGiorgi Dalakishvili6-Apr-08 7:57 
GeneralRe: how to change an existing console application into a service dll Pin
stephan_0076-Apr-08 8:11
stephan_0076-Apr-08 8:11 
GeneralSyncronizing TreeView nodes and RichTextBox [modified] Pin
Mark F.6-Apr-08 7:08
Mark F.6-Apr-08 7:08 
GeneralRe: Syncronizing TreeView nodes and RichTextBox Pin
Luc Pattyn6-Apr-08 7:30
sitebuilderLuc Pattyn6-Apr-08 7:30 
GeneralGet the SID of the user created a file Pin
Yevgeny Efter6-Apr-08 6:27
Yevgeny Efter6-Apr-08 6:27 
GeneralRe: Get the SID of the user created a file Pin
half-life6-Apr-08 7:42
half-life6-Apr-08 7:42 
GeneralSocketServer getting delay to listen client when if restart the server PC Pin
jklanka6-Apr-08 6:24
jklanka6-Apr-08 6:24 
GeneralC#, using MS Interop, how to reasonably use an instance for spell check Pin
Letmelogin6-Apr-08 5:34
Letmelogin6-Apr-08 5:34 
Came across the following code here in response to another question.
The idea was to spell check some text. I want to do the same thing, but with only instantiating the objects once. The reason for this is I'm going to be checking a ton of strings one at a time, and don't want to keep creating new objects. (good reasons for doing so, but probably not relevant)

The main question is how do I ensure only the current string is being checked? The .dll was not document friendly.

doc.Words.First.InsertBefore(tBox.Text);


Thanks to anyone who takes the time to answer this,

<br />
<br />
public void fSpellCheck(TextBox tBox, Label lLbl) <br />
<br />
   Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();<br />
            <br />
            // Setting these variables is comparable<br />
            // to passing null to the function. <br />
            // This is necessary because the C# null<br />
            // cannot be passed by reference. <br />
<br />
            object template = Missing.Value;<br />
            object newTemplate = Missing.Value;<br />
            object documentType = Missing.Value;<br />
            object visible = true;<br />
            object optional = Missing.Value;<br />
           <br />
            _Document doc = app.Documents.Add<br />
              (ref template,<br />
               ref newTemplate,<br />
               ref documentType,<br />
               ref visible);<br />
<br />
            doc.Words.First.InsertBefore(tBox.Text);<br />
            Microsoft.Office.Interop.Word.ProofreadingErrors we = doc.SpellingErrors;<br />
            iErrorCount = we.Count;<br />
            doc.CheckSpelling(ref optional, ref optional, ref optional,<br />
                ref optional, ref optional, ref optional, ref optional,<br />
                ref optional, ref optional, ref optional,<br />
                ref optional, ref optional);<br />
            if (iErrorCount == 0)<br />
                lLbl.Text = "Spelling OK. No errors corrected ";<br />
            else if (iErrorCount == 1)<br />
                lLbl.Text = "Spelling OK. 1 error corrected ";<br />
            else<br />
                lLbl.Text = "Spelling OK. " + iErrorCount +<br />
                                        " errors corrected ";<br />
            object first = 0;<br />
            object last = doc.Characters.Count - 1;<br />
<br />

GeneralOutOfMemoryException despite having 600+ MB of RAM free Pin
Jordanwb6-Apr-08 4:25
Jordanwb6-Apr-08 4:25 
QuestionRe: OutOfMemoryException despite having 600+ MB of RAM free Pin
CPallini6-Apr-08 4:39
mveCPallini6-Apr-08 4:39 
GeneralRe: OutOfMemoryException despite having 600+ MB of RAM free Pin
Jordanwb6-Apr-08 4:46
Jordanwb6-Apr-08 4:46 
GeneralRe: OutOfMemoryException despite having 600+ MB of RAM free Pin
CPallini6-Apr-08 6:23
mveCPallini6-Apr-08 6:23 
GeneralRe: OutOfMemoryException despite having 600+ MB of RAM free Pin
Jordanwb6-Apr-08 6:31
Jordanwb6-Apr-08 6:31 
GeneralRe: OutOfMemoryException despite having 600+ MB of RAM free Pin
Guffa6-Apr-08 6:11
Guffa6-Apr-08 6:11 
QuestionInvalidate picturebox with rectangle on Pin
Casper Hansen6-Apr-08 3:49
Casper Hansen6-Apr-08 3:49 
GeneralRe: Invalidate picturebox with rectangle on Pin
Luc Pattyn6-Apr-08 5:05
sitebuilderLuc Pattyn6-Apr-08 5:05 
Questionhow to validate a textbox in a window Form Pin
yangliuxiaowu6-Apr-08 1:40
yangliuxiaowu6-Apr-08 1:40 
AnswerRe: how to validate a textbox in a window Form Pin
Luc Pattyn6-Apr-08 5:08
sitebuilderLuc Pattyn6-Apr-08 5:08 
Questionselect domain name part of a url saved in a string Pin
Farhad Eft6-Apr-08 1:25
Farhad Eft6-Apr-08 1:25 
GeneralRe: select domain name part of a url saved in a string Pin
Ryan Bost6-Apr-08 5:22
Ryan Bost6-Apr-08 5:22 
GeneralRe: select domain name part of a url saved in a string Pin
Farhad Eft8-Apr-08 5:59
Farhad Eft8-Apr-08 5:59 
GeneralSoapFormatter: Ignore missing fields Pin
Roger Alsing5-Apr-08 23:24
Roger Alsing5-Apr-08 23:24 
QuestionHow to change caption text in default ColorDialog ? Pin
eslange5-Apr-08 23:03
eslange5-Apr-08 23:03 
GeneralPublish XNA Project (Please?) [modified] Pin
MasterSharp5-Apr-08 12:03
MasterSharp5-Apr-08 12:03 
GeneralRe: Publish XNA Project (Please?) Pin
MarkB7775-Apr-08 17:22
MarkB7775-Apr-08 17:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.