RadSpellChecker for WinForms Q1 2015 with custom dictionary

3 posts, 1 answers
  1. Guillermo
    Guillermo avatar
    4 posts
    Member since:
    Nov 2018

    Posted 17 Apr Link to this post

    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. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3276 posts

    Posted 18 Apr Link to this post

    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.
  3. Guillermo
    Guillermo avatar
    4 posts
    Member since:
    Nov 2018

    Posted 24 Apr in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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!.

Back to Top