0% found this document useful (0 votes)
85 views4 pages

Notepad Programming Code Overview

The document describes the functionality of a basic text editor program. It includes code snippets for common text editing functions like opening, saving, and creating new files. It also includes code to implement standard editing tools such as undo, cut, copy, paste, font selection, text alignment, and background color selection. The code checks for changes before saving and prompts the user to confirm overwriting existing files.

Uploaded by

OFFICIAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views4 pages

Notepad Programming Code Overview

The document describes the functionality of a basic text editor program. It includes code snippets for common text editing functions like opening, saving, and creating new files. It also includes code to implement standard editing tools such as undo, cut, copy, paste, font selection, text alignment, and background color selection. The code checks for changes before saving and prompts the user to confirm overwriting existing files.

Uploaded by

OFFICIAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Text files (*.

txt)|

File New
'Check if there's text added to the textbox
If [Link] Then
'If the text of notepad changed, the program will ask the user if they want to
save the changes
Dim ask As MsgBoxResult
ask = MsgBox("Do you want to save the changes", [Link], "New
Document")
If ask = [Link] Then
[Link]()
ElseIf ask = [Link] Then
ElseIf ask = [Link] Then
[Link]()
[Link]([Link], [Link],
False)
[Link]()
End If
'If textbox's text is still the same, notepad will open a new page:
Else
[Link]()
End If

File Open
'Check if there's text added to the textbox
If [Link] Then
'If the text of notepad changed, the program will ask the user if they want to
save the changes
Dim ask As MsgBoxResult
ask = MsgBox("Do you want to save the changes", [Link], "Open
Document")
If ask = [Link] Then
[Link]()
[Link] = [Link]([Link])
ElseIf ask = [Link] Then
ElseIf ask = [Link] Then
[Link]()
[Link]([Link], [Link],
False)
[Link]()
End If
Else
'If textbox's text is still the same, notepad will show the OpenFileDialog
[Link]()
Try
[Link] = [Link]([Link])
Catch ex As Exception
End Try
End If
File Save
[Link]()
' the application will check if the file is already exists, if exists, it will
ask the user if they want to replace it
If [Link]([Link]) Then
Dim ask As MsgBoxResult
ask = MsgBox("File already exists, would you like to replace it?",
[Link], "File Exists")
'if the user decides not to replace the existing file
If ask = [Link] Then
[Link]()
'if the user decides to replace the existing file
ElseIf ask = [Link] Then
[Link]([Link], [Link],
False)
End If
'if the file doesn't exist
Else
Try
[Link]([Link], [Link],
False)
Catch ex As Exception
End Try
End If

File Exit
End

Undo
'check if textbox can undo
If [Link] Then
[Link]()
Else
End If

Cut
[Link]()
If [Link] > 0 Then
[Link]([Link])

End If
[Link] = ""

Copy
[Link]()
If [Link] > 0 Then
[Link]([Link])

End If

Paste
If [Link] Then
[Link]()
End If

Select All
[Link]()

Find
Dim a As String
Dim b As String
a = InputBox("Enter text to be found")
b = InStr([Link], a)
If b Then
[Link]()
[Link] = b - 1
[Link] = Len(a)
Else
MsgBox("Text not found.")
End If

Format Font
[Link]()
[Link] = [Link]

Font Color
[Link]()
[Link] = [Link]

Align Left
[Link] = [Link]
[Link] = True
[Link] = False
[Link] = False
Center
[Link] = [Link]
[Link] = False
[Link] = True
[Link] = False

Right
[Link] = [Link]
[Link] = False
[Link] = False
[Link] = True

Background Color
[Link]()
[Link] = [Link]

You might also like