Spell Checker!

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts Page 1 of 1
Contributors
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Spell Checker!
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!!
You do not have the required permissions to view the files attached to this post.
Last edited by code it on Sun Jan 09, 2011 1:28 am, edited 3 times in total.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Spell Checker!
mandai
This will only work if you have Microsoft Office installed or it will fail at CreateObject("Word.Application").
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: Spell Checker!
code it
I forgot to mention that...
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

Re: Spell Checker!
zachman61
nice, too bad we need word lol
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: Spell Checker!
code it
yeah cryer; it sucks
User avatar
HarrySeddon
Just Registered
Just Registered
Posts: 6
Joined: Tue Jan 11, 2011 4:18 pm

Re: Spell Checker!
HarrySeddon
that looks alright
6 posts Page 1 of 1
Return to “Tutorials”