Hi there,

I have made a spell checker in PHP which does spell checking by splitting the words by space, checks wheather the word is spelled correctly from a database dictionary, if not, It shows some suggestions when a user clicks on it and also highllights the wrong spelled word... I want to make this thing in VB.NET. Any ideas? Please help. I am a advanced beginner in VB.Net..

Thanks in Advance...

Are you wanting an active spell check? (One that checks as you type)

or

Are you wanting a passive spell check? (One that checks the word after you type it)

Are you wanting an active spell check? (One that checks as you type)

or

Are you wanting a passive spell check? (One that checks the word after you type it)

Anyone...

For active:

1) Capture each character typed and query the database for possible solutions.

For passive:

1) The user leaves the text box, check against the database by splitting spaces and storing in the array.

Example of active:

Dim s As String = ""


Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

    'cmd = Command '
    'da = Data adapter'
    'ds = Data set'
    'dt = Data table'

    s = TextBox1.Text

    Dim sqls As String = "SELECT * FROM table WHERE value='" & s & "'"

    cmd = New Command(sqls,con)
    da.SelectCommand = cmd
    da.Fill(ds,"table1")
    dt = ds.Tables("table1")

    If dt.Rows.Count > 0 Then
        return
    Else
        TextBox1.BackColor = Color.Salmon
    End If

End Sub

For the passive:

Dim ar() As String

 Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

    'cmd = Command '
    'da = Data adapter'
    'ds = Data set'
    'dt = Data table'

    ar() = TextBox1.Text.Split(" ")

    For i = 0 to ar.Count - 1

        Dim sqls As String = "SELECT * FROM table WHERE value='" & ar(i) & "'"

        cmd = New Command(sqls,con)
        da.SelectCommand = cmd
        da.Fill(ds,"table1")
        dt = ds.Tables("table1")

        If dt.Rows.Count = 0 Then

        'place your code here for letting the user know it's misspelled.'

    Next  

End Sub

Another note, for the active - You can fill a context menu with the possible solutions and allow the user to click the one they want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.