This is a migrated thread and some comments may be shown as answers.

RadSpellChecker for WinForms Q1 2015 with custom dictionary

2 Answers 85 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Guillermo
Top achievements
Rank 1
Guillermo asked on 17 Apr 2019, 04:40 PM

Hello!, I implement a spell check control using a custom (spanish) dictionary without problem using Telerik UI for WinForms R3 2017.

But now, I need to implement the same functionality using Telerik UI for WinForms Q1 2015 (SpellChecker.dll version 2015.1.225.40) and I can't compile my code:

Thank you in advance!

            '----------------------------------------------------------------------------------------
            ' Diccionario espanol para uso con SpellChecker
            '----------------------------------------------------------------------------------------
Public Shared ReadOnly CulturaEspanol As Globalization.CultureInfo = Globalization.CultureInfo.GetCultureInfo("es-ES")
 
            '----------------------------------------------------------------------------------------
            ' Diccionario espanol para uso con SpellChecker
            '----------------------------------------------------------------------------------------
            Public Class MySpanishDictionary
                Inherits Telerik.WinControls.SpellChecker.Proofing.WordDictionary
                Protected Overrides Sub EnsureDictionaryLoadedOverride()
                    Dim ls_dicpath As String
                    Try
                        ls_dicpath = My.Application.Info.DirectoryPath & "\es-ES.tdf"
                        If Not File.Exists(ls_dicpath) Then
                            frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod, New Exception(ls_dicpath & " No Existe!."))
                            Exit Sub
                        End If
                        Using lb_ms As System.IO.MemoryStream = New System.IO.MemoryStream(File.ReadAllBytes(ls_dicpath))
                            Me.Load(lb_ms)
                        End Using
                    Catch ex As Exception
                        frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod, ex)
                    End Try
 
                End Sub
            End Class
 
            '----------------------------------------------------------------------------------------
            ' Setea Diccionario espanol para uso con SpellChecker
            '----------------------------------------------------------------------------------------
            Public Shared Sub setearDiccionario(ByRef ao_spcControl As Telerik.WinControls.UI.RadSpellChecker)
 
                Try
                    Dim lo_textBoxControlSpellChecker As Telerik.WinControls.UI.TextBoxSpellChecker = ao_spcControl.GetControlSpellChecker(GetType(Telerik.WinControls.UI.RadTextBox))
                    lo_textBoxControlSpellChecker.ShowAllCapitalLettersWord = True
                    Dim lo_documentSpellChecker As Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker = TryCast(lo_textBoxControlSpellChecker.SpellChecker, Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker)
                    lo_documentSpellChecker.SpellCheckingCulture = CulturaEspanol
                    lo_documentSpellChecker.AddDictionary(New MySpanishDictionary(), CulturaEspanol)
 
                Catch ex As Exception
                    frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod, ex)
                End Try
 
            End Sub
 
.... at form you can use it:
 
            '-----------------------------------------------------------------------
            ' Spell Check "as you type" en componente texto observaciones
            ' spcCheck is RadSpellChecker
            ' txtObservaciones is RadTextBox
            '-----------------------------------------------------------------------
            spcCheck.AutoSpellCheckControl = txtObervaciones
            FG.Controles.Comunes.setearDiccionario(spcCheck)

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Apr 2019, 10:34 AM
Hello, Guillermo,    

The WordDictionary and DocumentSpellChecker were introduced in version 2016.3.1024. Hence, you need to upgrade to at least this version in order to benefit from the introduced functionality. 

Alternatively, add a reference to Telerik.WinControls.RichTextBox which should be available in the old version and import Telerik.WinControls.RichTextBox.Proofing. Then, the code is expected to be compiled.

Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket.

Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Guillermo
Top achievements
Rank 1
answered on 24 Apr 2019, 04:17 PM

It works!

You must create manually a reference to use it: 

Dim spcCheck As New Telerik.WinControls.UI.RadSpellChecker

...

spcCheck.AutoSpellCheckControl = txtObervaciones
FG.Controles.Comunes.setearDiccionario(spcCheck)

Thank you very much!.

Tags
General Discussions
Asked by
Guillermo
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Guillermo
Top achievements
Rank 1
Share this question
or