[RESOLVED] RobDogs Spellcheck with array ?
Guys & RobDog !
I am using RD's .net spell checker and it is working sweet as a nut. But I was wondering if it would be possible to make a slight adjustment.
My problem at the moment is that I have around 15 different screens that need to use this, each screen could have upto 5 textboxes that need to be checked.
So, I have the SpellCheck code in a dll, and reference it each time I need to perform the check using something along the lines of.....
VB Code:
Public Sub Spell()
Try
'Get New instance of PWBSpell.dll
Dim Spell As PWBspell.clsSpellMe = New PWBspell.clsSpellMe
'Perform SpellCheck
tb_NTCComments.Text = Spell.SpellMe(tb_NTCComments.Text)
tb_NTCSubject.Text = Spell.SpellMe(tb_NTCSubject.Text)
Catch ex As Exception
EH.Log(ex)
End Try
End Sub
Where tb_.... are the textboxes to check.
Because the number of items to check on each screen varies, I am running the SpellMe function multiple times (Twice in this eg). Would it not be possible to send a string array to the function, SpellMe could run through each item in the array, then return a new array containing the corrected values ? Or is what I am doing now the best method.
Thanks in advance, and thanks again to RobDog for another fantastic bit of code.
Bob
Re: RobDogs Spellcheck with array ?
Thaks :thumb: I'm glad you like it. :D
You could concatinate the textboxes and perform a spellcheck on the entire string. The hard part will be knowing how to split it back to your textboxes with having a delimiter that doesnt invoke a misspelling or grammer issue.
Re: RobDogs Spellcheck with array ?
Thanks RD, s'pose the concatinate thing could work, but like you said its going to be difficult separating the strings without giving problems.
Anyway, its working just fine as it is ta.
Bob
Re: [RESOLVED] RobDogs Spellcheck with array ?
I think a pipe character will not trigger any issues. I did a quick test and it didnt pick it up. So try concatinating all to be spelled textboxes, pass it to the SpellMe function, then parse by Split function to an array and replace each textboxes contents.
Pipe char: "|"
Re: [RESOLVED] RobDogs Spellcheck with array ?
I don't get what the problem is. Why can't you just do what you said youself?
VB Code:
Public Sub CorrectSpelling(ByVal strings As String())
Dim Spell As PWBspell.clsSpellMe = New PWBspell.clsSpellMe
For Each str As String in Strings
str = Spell.SpellMe(str)
Next str
End sub
You can then place this method wherever you like. Alternatively you could inherit Rob's class and add another overload of the SpellMe method that does the same thing, calling the existing overload internally.
Re: [RESOLVED] RobDogs Spellcheck with array ?
Just instead of making several calls to the spell checking dialog, it would/may be best to have it spell check all ranges at once.
Re: [RESOLVED] RobDogs Spellcheck with array ?
Quote:
Originally Posted by RobDog888
Just instead of making several calls to the spell checking dialog, it would/may be best to have it spell check all ranges at once.
I haven't used this spell checker so maybe I don't understand something. Would multiple calls open multiple dialogues, one for each string?
Re: [RESOLVED] RobDogs Spellcheck with array ?
One per call to SpellMe. So if its like he has in the first post you will be invoking the dialog twice but in series.
:eek: You mean you havent used my SpellCheckerâ„¢ :(
Re: [RESOLVED] RobDogs Spellcheck with array ?
Quote:
Originally Posted by RobDog888
:eek: You mean you havent used my SpellCheckerâ„¢ :(
Downt neeed tu yous it. ;)
Re: [RESOLVED] RobDogs Spellcheck with array ?
RobDog,
The Pipe char works like a charm. You are a true gent and a star, I think I love you. :blush: