Page 1 of 1

Spell Checker!

Posted: Sun Jan 09, 2011 12:14 am
by code it
ATTN:Credits go to http://www.a1vbcode.com/app-3641.asp but I only used the code and edited it bit

What You Need

1 Label (Label1)
1 Button(Button1)
1 TextBox(TextBox1)
_________________________________________________
Form1 Properties:
Size: 472, 68
Text: Spell Checker (DUH)
MinimizeBox = False
MaximizeBox = False
FormBorderStyle = Fixed Single
_________________________________________________
TextBox1 Properties:
Size: 237, 20
Text:
Location 12, 8
_________________________________________________
Label1 Properties:
Size: 85, 13
Location: 336, 11
Text: The Spelling is...
_________________________________________________
Button1 Properties:
Size: 75, 23
Location: 255, 6
Text: Check
_________________________________________________
Coding Time!

Code:
Code: Select all
Public Class Form1
    Public Function OnlyCharacter(ByVal key As String) As Boolean
        If (key >= 65 And key <= 90) Or (key >= 97 And key <= 122) Or key = 8 Then
            OnlyCharacter = False

        Else
            OnlyCharacter = True
        End If
    End Function
    Private Function chkSplng(ByVal sTxt As String) As Boolean
        Dim spellCheker As New Object()
        spellCheker = CreateObject("Word.Application")
        chkSplng = spellCheker.CheckSpelling(sTxt)
    End Function

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        e.Handled = OnlyCharacter(Asc(e.KeyChar))
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Text As String
        On Error Resume Next
        Text = TextBox1.Text

        If Text = "" Then
            MsgBox("Type a text to check if the spelling is correct!", vbExclamation)
            Exit Sub
        End If

        If chkSplng(Text) = True Then
            Label1.ForeColor = Color.Green
            Label1.Text = "The Spelling is Correct!"
        Else
            Label1.ForeColor = Color.Red
            Label1.Text = "The Spelling is Incorrect!"
        End If

        Text = ""
    End Sub
End Class

_________________________________________________________________________
Screenshots: Of course!


A word that is spelled correct:
correct.JPG


A word that is spelling incorrect,I just made it up obviously:
incorrect.JPG






Please +Rep me if you liked it and think it is useful :D :)

_______________________________________________________________
NOTE:YOU NEED MIRCOSOFT OFFICE FOR IT TO WORK!!

Re: Spell Checker!

Posted: Sun Jan 09, 2011 12:23 am
by mandai
This will only work if you have Microsoft Office installed or it will fail at CreateObject("Word.Application").

Re: Spell Checker!

Posted: Sun Jan 09, 2011 12:32 am
by code it
I forgot to mention that...

Re: Spell Checker!

Posted: Sun Jan 09, 2011 12:43 am
by zachman61
nice, too bad we need word lol

Re: Spell Checker!

Posted: Sun Jan 09, 2011 12:53 am
by code it
yeah cryer; it sucks

Re: Spell Checker!

Posted: Tue Jan 11, 2011 4:24 pm
by HarrySeddon
that looks alright