![]() |
|
[.NET] [Tutorial]How to make an advanced Notepad in VB.NET![Tutorial] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [Tutorial]How to make an advanced Notepad in VB.NET![Tutorial] (/showthread.php?tid=1471823) Pages: Pages
1
2
|
[Tutorial]How to make an advanced Notepad in VB.NET![Tutorial] - Skillful - Jul 11, 2011 Hello guys, Here I present my first tutorial!! In this tutorial I am going to teach you how to make an advanced text editor!!! :D Hope you like it!!! :D cooll; 1. First open up VB.NET and create a new Windows Forms project with framework version 3.00. 2. After the project loads edit Form 1's these properties - Size - 864, 659 StartPosition - CenterScreen Text - Advanced Text Editor 3. Then drag a Menustrip, OpenFileDialog and SaveFileDialog onto the Form and then create menu items in the same order as that in this screen shot - [img]http://farm6.static.flickr.com/5007/5303620235_e74def2012_z.jpg[/img] 4. Now add sub items under the file menu item in the same order as given below- Open Save Save As New Exit 5. Now add sub items under the Font menu item in the same order as given below- Font Type Font Style (add sub items under this in the same order as given- Bold,Underline,Italic,Strikeout) Font Color Convert Case (add sub items under this in the same order as given- To UPPER,To lower) 6. Now add sub items under the Page menu item in the same order as given below- Page Color 7. Now add sub items under the Text Alignment menu item in the same order as given below- Left Center Right 8. Now add sub items under the Indent menu item in the same order as given below- +1 -1 9. Now add sub items under the Bullets menu item in the same order as given below- Add Remove 10. Now add sub items under the Find & Replace menu item in the same order as given below- Find Replace Find & Replace 11. Now add sub items under the Insert menu item in the same order as given below- Image 12. Now add sub items under the Zoom menu item in the same order as given below- In Out 13. Now add sub items under the Undo & Redo menu item in the same order as given below- Undo Redo 14. Now add sub items under the Clipboard menu item in the same order as given below- Copy Cut Paste Select All Text Erase All Text 15. Now add sub items under the View In menu item in the same order as given below- Web Browser 16. Now add sub items under the Text Reader menu item in the same order as given below- Selected Text Full Document Settings Stop Speaking 17. Drag a Status strip on to the form and create Tool strip status labels in the same order as in the screen shot above. 18. Drag 5 labels from the toolbox on to the status strip and change these properties- Visible = False 19. Change Label5's text property to 50 and Label4's text property to 0. 20. Drag a Rich text box from the toolbox on to the form and change these properties of it- Dock - Fill 21. Now click on the VB.NET menu item called Project and then select Add Reference. Then go to the .NET tab and then search for System.Speech. Once you find it, select it and then click OK. 22. Now right click anywhere on the form and then click on view code and paste this code above Public Class Form1- Code Imports System.Speech.SynthesisCode Dim cf As String23. Double click on the Open menu item under the File menu item of the menustrip on the form and add this code to it- Code If RichTextBox1.Modified Then24. Similarly double click on the Save menu item and add this code to it- Code If cf = "" Then25. Now double click on the Save As menu item and add this code to it- Code SaveFileDialog1.Title = "RTE - Save File"26. Double Click on the New menu item and add this code to it- Code If RichTextBox1.Modified Then27. Double click on the Exit menu sub item under File and add this code to it- Code If RichTextBox1.Modified = True Then28. Double click on Font Type menu item and add this code to it- Code Try29. Double Click on the Bold menu sub item under Font-->Font Styles and add this code to it- Code Dim currentf As System.Drawing.Font = RichTextBox1.SelectionFont30. Double Click on the Underlinemenu sub item under Font-->Font Styles and add this code to it- Code Dim currentf As System.Drawing.Font = RichTextBox1.SelectionFont31. Double Click on the Italic menu sub item under Font-->Font Styles and add this code to it- Code Dim currentf As System.Drawing.Font = RichTextBox1.SelectionFont32. Double Click on the Strikeout menu sub item under Font-->Font Styles and add this code to it- Code Dim currentf As System.Drawing.Font = RichTextBox1.SelectionFont33. Double Click on the Font Color menu sub item under Font and add this code to it- Code Dim fontc As New ColorDialog34. Double click on the Page Color menu sub item under Page and add this code to it- Code Dim pagec As New ColorDialog35. Double click on the Left menu sub item under Text Alignment and add this code to it- Code RichTextBox1.SelectionAlignment = HorizontalAlignment.Left36. Double click on the Center menu sub item under Text Alignment and add this code it- Code RichTextBox1.SelectionAlignment = HorizontalAlignment.Center37. Double click on the Right menu sub item under Text Alignment and add this code to it- Code RichTextBox1.SelectionAlignment = HorizontalAlignment.Right38. Double click on the +1 menu sub item under Indent and add this code to it- Code RichTextBox1.SelectionIndent += 139. Double click on the -1 menu sub item under Indent and add this code to it- Code Try40. Double click on the Add menu sub item under Bullets and add this code to it- Code RichTextBox1.BulletIndent = 1041. Double click on the Remove menu sub item under Bullets and add this code to it- Code RichTextBox1.SelectionBullet = False42. Double click on the Image menu sub item under Image and add this code it- Code Try43. Double click on the In menu sub item under Zoom and add this code to it- Code RichTextBox1.ZoomFactor += 144. Double click on the Out menu sub item under Zoom and add this code to it- Code Try45. Double click on the Undo menu sub item under Undo & Redo and add this code to it- Code RichTextBox1.Undo()46. Double click on the Redo menu sub item under Undo & Redo and add this code it- Code RichTextBox1.Redo()47. Double click on the Copy sub menu item under Clipboard and add this code to it- Code RichTextBox1.Copy()48. Double click on the Cut sub menu item under Clipboard and add this code to it- Code RichTextBox1.Cut()49. Double click on the Paste menu sub item under Clipboard and add this code to it- Code RichTextBox1.Paste()50. Double click on the Select All Text menu sub item under Clipboard and add this code it- Code RichTextBox1.SelectAll()51. Double click on the Erase All Text menu sub item under Clipboard and add this code to it- Code RichTextBox1.Text = ""52. Double click on the Web Browser menu sub item under View In and add this code to it- Code Dim w As StreamWriter = New StreamWriter(Environment.CurrentDirectory & "\" & "npwb.html")53. Now add a new form to your project by clicking the VB.NET menustrip--> Project-->Add Windows Form and then name it Form2 and change its these properties- FormBorderStyle - FixedSingle MaximizeBox - False Size - 343,183 Text - Find & Replace 54. Add 2 labels, 2 Text boxes, 1 check box, 4 buttons on to the form and change its these properties- Label1 Location - 3,9 Text - Find What TextBox1 Location - 6,25 Size - 319,20 Label2 Location - 3,58 Text - Replace With TextBox2 Location - 6,74 Size - 319,20 Button1 Location - 6,124 Size - 75,23 Text - Find Button2 Location - 87, 124 Size - 75,23 Text - Find Next Button3 Location - 168,124 Size - 75,23 Text - Replace Button4 Location - 249,124 Size - 75,23 Text - Replace All CheckBox1 Location - 6,101 Text - Match Case 55. Double click on the Find button and add this code to it- Code Dim sp As Integer56. Double click on the Find Next button and paste this code- Code Dim sp As Integer = Form1.RichTextBox1.SelectionStart + 257. Double click on the Replace button and add this code to it- Code If Form1.RichTextBox1.SelectedText.Length <> 0 Then58. Double click on the Replace All button and add this code to it- Code Dim cp As Integer = Form1.RichTextBox1.SelectionStart59. Create one more new form by clicking on VB.NET menu item called Project-->Add Windows Form and name the form Form3 and change these properties of it- FormBorderStyle - FixedSingle MaximizeBox - False Size - 283, 106 Text - Find 60. Drag 1 label, 1 Textbox, 1 check box and 2 buttons on to the form and change its these properties- Label1 Location - 3,9 Text - Find What TextBox1 Location - 6,26 Size - 259,20 CheckBox1 Location - 6,53 Text - Match Case Button1 Location - 109,47 Size - 75,23 Text - Find Button2 Location - 190,47 Size - 75,23 Text - Find Next 61. Double click on the Find button on the Form and add this code to it- Code Dim sp As Integer62. Double click on the Find Next button on the Form and add this code to its- Code Dim sp As Integer = Form1.RichTextBox1.SelectionStart + 263. Create a new Windows Form by clicking on the VB.NET menu item called Project-->Add Windows Form and then name it Form4.vb and then its these properties- FormBorderStyle - FixedSingle MaximizeBox - False Size - 285,157 Text - Text Reader Settings 64. Drag 3 labels, 2 trackbars and 1 combo box from the toolbox on to the form and change its these properties- Label1 Location - 3,17 Text - Select Voice : Label2 Location - 12,50 Text - Speed : Label3 Location - 12,91 Text - Volume ComboBox1 Location - 76,14 Size - 191,21 Text - Microsoft Anna TrackBar1 Location - 76,41 Size - 191,45 Maximum - 10 Minimum - -10 TickFrequency - 2 Value - 0 TrackBar2 Location - 76,80 Size - 191,45 Maximum - 100 Minimum - 0 TickFrequency - 10 Value - 50 65. Right click anywhere on the form and click View Code, erase whatever code is present there and then paste this code- Code Imports System.Speech.Synthesis66. Close the form and then go to Form1 and double click on the Find menu sub item under Find & Replace and add this code to it- Code Form3.Show()67. Double click on the Replace menu sub item under Find & Replace and add this code to it- Code Form2.Show()68. Double click on the Find & Replace menu sub item under Find & Replace and add this code to it- Code Form2.Show()69. Double click on the Selected Text menu sub item under Text Reader and add this code to it- Code p_objSynth.SelectVoice(Form4.ComboBox1.Text)70. Double click on the Full Document menu sub item under Text Reader and add this code to it- Code p_objSynth.SelectVoice(Form4.ComboBox1.Text)71. Double click on the Settings menu sub item under Text Reader and add this code to it- Code Form4.Show()72. Double click on the Stop Speaking menu sub item under Text Reader and add this code to it- Code p_objSynth.SpeakAsyncCancelAll()Here are the project files- http://www.mediafire.com/?val27z04da3t55g * - Deceptive - Jul 11, 2011 Great tutorial, hopefully this will provide of use to newer members. * - Kiyongo - Jul 11, 2011 wow nice one mate... Bookmarked... Going to try it now.. Thanks * - Skillful - Jul 11, 2011 Thanks for your comments guys. Please rate this thread so that other new members can gain help from it. * - ¤ Nick™ ¤ - Jul 11, 2011 This is a very nice release, and you look like you know what you're doing. :) * - IDontNeedAUsername - Jul 11, 2011 Nice Tutorial! TooShort.. * - El moniel - Jul 12, 2011 Great work dude thnaks for share 👍👍 really good work man 🙂 * - Zercox - Jul 12, 2011 Nice work! I'am a newbi from Norway so I'am going to give it a try! * - Ingenuity - Jul 12, 2011 Nice tutorial, although you should incorporate RichEdit 6.0 or 7.0. Then you'll have way more control of the textbox control & have more potential to make use of all of the RTF file's capabilities - such as justification, etc. * - cr3dotw - Jul 12, 2011 Easy but good for the news members. Thanks for your share. * - madTRiiKs - Jul 12, 2011 Thanks for this, it will come in handy to a lot of people including me * - Skillful - Jul 12, 2011 Thank you for your comments guys. I'm glad this tutorial helped you'll. * - Base.exe - Dec 14, 2011 Nice tutorial helped alot! -Base.exe * - Meerkat. - Dec 14, 2011 Good tutorial for beginning coders! Oh, btw, this tutorial is even faster! http://notepad-plus-plus.org/download/v5.9.6.2.html * - Nazworth - Dec 14, 2011 Nice thing you have here. Only issue is that all there doing is just copy and pasting the code and not learning anything. |