I was bored and I have started to create a very extensive Multi-Document-Interface Text Editor (like Notepad, but much more features) as an 'example' text editor project.
At this point it is still a work in progress (WIP) but I will add things to this when I find the time / inspiration.
I have tried to make my code as neat as I could, even though it doesn't have very many comments. I have added a comment here and there to explain what a function does or why it's there, but not nearly everywhere. I have tried to keep the variables and function names as clear as I could so you should be able to follow the code without too much problems.
Still, if you have any questions about a specific part of this program, feel free to ask me (in this thread) and I will be glad to explain.
Also, I would be very thankful if you could view my code and point out the (probably) many mistakes or whatever... That would really help me out alot!
Now, on to my program.
The basics of my program are similar to Notepad, only then with a Multi-Document-Interface (MDI). However, my program has a lot more features and functions, many inspired by Visual Studios features.
Here is a list of all the features (or at least those I could remember) with an occasional screenshot to clarify things.
Multi-Document-Interface text editor as shown in the screenshot:
Standard New, Open, Save, Save As features, plus additional Save All function and Recent Files list. (The Recent Files list is still a WIP and can contain errors. The printer functions are not working yet.)
Standard Edit menu with Undo/Redo/Cut/Copy/Paste/Select All/Find & Replace (in one dialog)/Go To and Insert Date functions:
Tools menu with Word Count and Options (only a few options exist yet). The Options window has a cool little Help feature I made up where you hover your mouse over the option and the help box below shows the help on that option.
Three Window Alignment options that align the windows in a specified way quickly. Minimized windows are only affected by this if specified in the Options.
Split Document feature, where the active document is split in two allowing you to edit the document in two separate places simultaneously.
Synchronized Scrolling feature (only for Split documents for now, but in the future I hope to realize this for every document). Synchronizes scrolling between the two textboxes in a Split document.
'Windows' feature. Shows all the active windows in a neat little Listview, allowing you to Activate, Save or Close the selected documents quickly.
(Image also shows a Split document)
The 'Save Changes?' window which shows when you try to close the program when there are unsaved (changed) documents. This window allows you to uncheck the documents you don't wish to save and save only the checked documents, or save none of them, or even cancel the closing.
If you only close a single document instead of all documents at once (by closing the program or using the Close all documents menuitem) you will see a standard warning:
As a 'bonus', the Listview controls use the vista APIs to support the Vista explorer-like look.
Unfortunately, it does not have a Tabbed MDI interface, the childwindows just float around. This is because I have never found a satisfying and free tabbed mdi control to use. I have however used professional versions before and with all of them you could simply drop the control on to the form and you're DONE, the control handles everything. However, for obvious reasons, I did not include these controls in this program.
That's it for now (I think, I probably forget a bunch of things)...
I hope you like it, and I hope you can use it!
I have attached the entire source code (including images etc) in this post. Be aware that this is created with Visual Studio 2008 so I don't think any earlier versions can open this...
(I had to delete the 'bin' and 'obj' folders to get the filesize below 500 kb, I hope this is not an issue, right?)
See ya..
Last edited by NickThissen; Aug 30th, 2008 at 12:28 PM.
Yes, the word count is not completely right. I compared it to MS Word 2007's word count and it would sometimes not be the same, but sometimes it would...
The printer functions don't work yet, as I've said in the first post.
What do you mean about the large scrollbars..? I don't see anything odd about them. Do you perhaps mean the scrollbars in the pictures? They are so big because there is heaps of text in them lol...
Sorry, I read your post on a computer that didn't have VB.NET on it then went on one that did and didn't bother re-reading it; forgetting about the printing bit.
I am not developing this application actively but if I find some time and motivation to work on this I might add your features.
The sentence counter is basically the same as the word counter, only using different characters to check for the end of a word / sentence.
The selected text info is also basically the same as what it does now, only then instead of using RTB.Text, you use RTB.SelectedText. Won't be too hard to try that yourself no?
A revert to last-saved feature is a good and easy to implement idea, thanks!
I don't know what you mean by Auto-Text, nor can I find anything in the help section in Word 2007. Can you explain?
So it's basically a template where you are only allowed to change / type a few predefined words? That does sound too advanced for my text editor imo...
So it's basically a template where you are only allowed to change / type a few predefined words? That does sound too advanced for my text editor imo...
can someone help me with thise search..
i want when i press search button to select the word in the Document (Textbox) field like thise program MDI text editor
here is mine code:
Code:
Dim re As String = ""
Dim match As String = ""
For Each a In TextBox2.Text.Split(" ")
re = re & "(?=.*?" & a & ".*?)"
Next
match = Nothing
For x As Integer = 0 To Document.Lines.Count - 1
If Regex.IsMatch(Document.Lines(x), re, RegexOptions.IgnoreCase) Then
match += x + 1 & ", "
End If
Next
If match.Length > 0 Then
MsgBox("Match found at line " & match.Remove(match.Length - 2, 2))
Else
MsgBox("No match")
End If
What you ask for is already there in the example; there's a Find & Replace dialog.
What your code shows however looks much more involved than a simple Find feature. Can't you explain a little more what you are trying to do? It looks like you are 'forcing' the program to use regular expressions, even on normal word searches, is that right? If so, why? I can't see any reason to do that, as the Find feature of the RichTextBox (which I'm using in the example) works just fine.
Furthermore, you didn't even tell me what the problem with your code is.