|
-
May 3rd, 2007, 01:17 AM
#1
Thread Starter
Banned
Advanced Text Editor
Hey,
I'm scriptking1 and recently I've started a project, and it is an advanced text editor. This text editor won first in the TSA(Technology Student Association)2007 State Level Conference. I would be going to the national level, but apparently they don't have that competition available to middle school students. Anyway, I continued working on the project, adding better features like Spell Check, and Find... I also fixed bugs like an unchecked word wrap which led you to believe that it was off. I ran into a dillemma though, all the posts for the spell check feature aren't what I initially wanted. I wanted spell check to be like Word where as soon as you made the error, it underlined it (_______) kinda like that, and gave you options as how to fix it. Can anyone please help me with this. Also, being wrapped up in the spell check dillemma, won't let me concetrate, and I can't think of any extra-features to add-in. If you download my installer of Programmer's Editor v.1.1.0.3 down below, you can see what I have so far in this developing project. Thanks in advance for anyone who can help me, or anyone who tries.
P.S I had to learn VB.NET in a couple of days for the TSA Competition, so please explain how to do any of your sugestions, for I guess you can say I'm a Noob.
Note: I promise to add Images and stuff later as soon as I set them up.
I got this code from RobDog888, and I changed it around to fix the errors showing on my pc.
The Spell Check Code I'm Currently Using.
vb Code:
Option Explicit On
Option Strict On
'Copyright © 2005 by RobDog888 (VB/Office Guru™). All Rights reserved.''Distribution: You can freely use this code in your own' applications provided that this copyright' is left unchanged, but you may not reproduce' or publish this code on any web site, online' service, or distribute as source on any' media without express permission.
Imports Microsoft.Office.Interop
Public Class SpellCheck
Friend moApp As Word.Application
Private mbKillMe As Boolean
Friend Property KillMe() As Boolean
Get
InitializeMe()
KillMe = mbKillMe
End Get
Set(ByVal Value As Boolean)
mbKillMe = Value
End Set
End Property
Friend Sub InitializeMe()
Try
'<INITIALIZE WORD>
moApp = DirectCast(GetObject(, "Word.Application"), Word.Application)
Catch ex As Exception
If TypeName(moApp) = "Nothing" Then
moApp = DirectCast(CreateObject("Word.Application"), Word.Application)
mbKillMe = True
Else
MessageBox.Show(ex.Message, "VB/Office Guru™ SpellChecker™.NET", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Try
End Sub
Friend Function SpellMe(ByVal msSpell As String) As String
Dim oDoc As Word.Document
Dim iWSE As Integer
Dim iWGE As Integer
Dim iResp As Integer
Dim sReplace As String
If msSpell = String.Empty Then Exit Function
Try
InitializeMe()
Select Case moApp.Version
Case "9.0", "10.0", "11.0"
oDoc = moApp.Documents.Add(, , 1, True)
Case "8.0"
oDoc = moApp.Documents.Add
Case Else
MessageBox.Show("Unsupported Version of Word.", "VB/Office Guru™ SpellChecker™.NET", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Function
End Select
oDoc.Words.First.InsertBefore(msSpell)
iWSE = oDoc.SpellingErrors.Count
iWGE = oDoc.GrammaticalErrors.Count
'<CHECK SPELLING AND GRAMMER DIALOG BOX>
If iWSE > 0 Or iWGE > 0 Then
'<HIDE MAIN WORD WINDOW>
moApp.Visible = False
If (moApp.WindowState = Word.WdWindowState.wdWindowStateNormal) Or _
(moApp.WindowState = Word.WdWindowState.wdWindowStateMaximize) Then
moApp.WindowState = Word.WdWindowState.wdWindowStateMinimize
Else
moApp.WindowState = Word.WdWindowState.wdWindowStateMinimize
End If
'</HIDE MAIN WORD WINDOW>
'<PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.CheckGrammarWithSpelling = True
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.SuggestSpellingCorrections = True
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreUppercase = True
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreInternetAndFileAddresses = True
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreMixedDigits = False
moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.ShowReadabilityStatistics = False
'</PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
'<DO ACTUAL SPELL CHECKING>
moApp.Visible = True
moApp.Activate()
iResp = moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Display
'</DO ACTUAL SPELL CHECKING>
If iResp < 0 Then
moApp.Visible = True
MessageBox.Show("Corrections Being Updated!", "VB/Office Guru™ SpellChecker™", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
oDoc.Select()
oDoc.Range.Copy()
sReplace = DirectCast(Clipboard.GetDataObject.GetData("System.String", True), String)
'<FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
End If
'</FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
SpellMe = sReplace
ElseIf iResp = 0 Then
MessageBox.Show("Spelling Corrections Have Been Canceled!", "VB/Office Guru™ SpellChecker™.NET", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
SpellMe = msSpell
End If
Else
MessageBox.Show("No Spelling Errors Found" & Environment.NewLine & "Or No Suggestions Available!", _
"VB/Office Guru™ SpellChecker™.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
SpellMe = msSpell
End If
'</CHECK SPELLING AND GRAMMER DIALOG BOX>
oDoc.Close(False)
oDoc = Nothing
'<HIDE WORD IF THERE ARE NO OTHER INSTANCES>
If KillMe = True Then
moApp.Visible = False
End If
'</HIDE WORD IF THERE ARE NO OTHER INSTANCES>
Catch ex As Exception
MessageBox.Show(ex.Message, "Welcome To Programmer's Editor Spell Check", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End Function
End Class
If RobDog888 Reads This: The Exit Function on line 37 is giving me a warning.
Download this .zip file to get the installer, and source code.
Last edited by ScriptKing1; May 3rd, 2007 at 06:47 PM.
Reason: I'm leaving
-
May 3rd, 2007, 06:32 AM
#2
-
May 3rd, 2007, 03:23 PM
#3
Re: Advanced Text Editor
Why did you remove my Copyright disclaimer from my code comments? That is a copyright infringement.
I dont believe the TSA would appreciate you using someone elses code in your code seing how its a competition for scholarships and awards etc. So please do not enter your app in any future contests without the proper acknowledgements in the code and in your app somewhere visible.
Thank you.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 3rd, 2007, 03:34 PM
#4
Thread Starter
Banned
Re: Advanced Text Editor
Sorry, i haven't even published it yet. I referenced it in the post as your code though, and i left your VB/Office Guru™ SpellChecker™.NET.
I wasn't even posting this as my own tutorial. I just posted it for you to see, and help me.
P.S TSA isn't for scholarships and etc. and the competition already passed.
I didn't have spell check in that version, i used my own code.
I'll put back you Copyright disclaimer, even though vb doesn't compile notes.
-
May 3rd, 2007, 04:07 PM
#5
Addicted Member
Re: Advanced Text Editor
 Originally Posted by ScriptKing1
I'll put back you Copyright disclaimer, even though vb doesn't compile notes.
True, VB doesn't compile comments, but in a situation where I might use someone elses code and they requested acknowledgement, then I would give them acknowledgement in the help file and/or about dialog.
CT
-
May 3rd, 2007, 04:16 PM
#6
Thread Starter
Banned
Re: Advanced Text Editor
Thanks, but i know that. It is just that he thinks i'm going to infringe his work even though i referenced him on this page, i told him i was adding this spell check for fun, not for competition, because competition is over(about 3 weeks ago.). Also i told him that i made that page for him to look at. I'm being dead honest, and now he's so pissed off, he won't help me with my problem. So if you know him, please let him know i am being sincere.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|