Project 9 Notepad Application Using Mdi Form: Rollno: 04613704409

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

RollNo: 04613704409

Project 9

NOTEPAD APPLICATION USING MDI FORM

Create an application for MDI form

Property table for controls used in application:

Control Name of control Properties Value


FORM Mdi_note , frm_1 , Caption NOTEPAD , child1 , child2
frm_child1
Window state Normal
Backcolor Button face
LABEL Frm_1: Lbl_file Font Times new roman
Frm_child1: lbl_1
Size 10

Backcolor Button face


Caption File contents , color me

TEXTBOX Frm_1 : txt_1 Backcolor Window background


Frm_child: Txt_color
Text My color

COMMON Cmd1 Orientation cdlportrait


DIALOG
BOX

TABLE 9.1
RollNo: 04613704409

MDI MENU
RollNo: 04613704409
RollNo: 04613704409

CODING
RollNo: 04613704409

Dim filename As String

Private Sub mdi_back_Click()


On Error Resume Next
cmd1.ShowColor
frm_child1.TXT_COLOR.BackColor = cmd1.Color
End Sub

Private Sub mdi_cas_Click()


Arrange vbCascade 'Arranging forms
End Sub

Private Sub mdi_copies_Click()


On Error Resume Next
cmd1.CancelError = True 'for print box
cmd1.Copies = 8
cmd1.FromPage = 1
cmd1.ToPage = 3
cmd1.ShowPrinter
End Sub

Private Sub mdi_copy_Click()


Clipboard.SetText frm_1.txt_1.SelText 'copy text
mdi_paste.Enabled = True
End Sub

Private Sub mdi_cut_Click()


Clipboard.SetText frm_1.txt_1.SelText
frm_1.txt_1.SelText = ""
mdi_paste.Enabled = True
End Sub

Private Sub mdi_end_Click()


End
End Sub

Private Sub mdi_exit_Click()


End
End Sub

Private Sub mdi_find_Click()


Dim a, n As String
a = InputBox("Enter the text u want to find")

n = InStr(frm_1.txt_1.Text, a)
RollNo: 04613704409
If n Then 'find text
MsgBox n
frm_1.txt_1.SelStart = n - 1
MsgBox Len(a)
frm_1.txt_1.SelLength = Len(a)
Else
MsgBox "sorry data not found", vbInformation
End If
End Sub

Private Sub mdi_fnr_Click()


Dim a, n As String
a = InputBox("Enter the text u want to replace")
n = InputBox("Enter the text by which u want to replace")
i = InStr(frm_1.txt_1.Text, a)
If i Then 'find and replace
frm_1.txt_1.Text = Replace(frm_1.txt_1.Text, a, n)
Else
MsgBox "Sorry data not found", vbCritical
End If
End Sub

Private Sub mdi_fnt_txt_Click()


On Error Resume Next
cmd1.Flags = cdlCFBoth + cdlCFForceFontExist + cdlCFEffects
cmd1.ShowFont
frm_child1.TXT_COLOR.FontSize = cmd1.FontSize
frm_child1.TXT_COLOR.FontBold = cmd1.FontBold
frm_child1.TXT_COLOR.FontItalic = cmd1.FontItalic 'font setting
frm_child1.TXT_COLOR.FontName = cmd1.FontName
frm_child1.TXT_COLOR.ForeColor = cmd1.Color
End Sub

Private Sub mdi_fore_Click()


On Error Resume Next
cmd1.ShowColor
frm_child1.TXT_COLOR.ForeColor = cmd1.Color
End Sub

Private Sub mdi_horz_Click()


Arrange vbTileHorizontal
End Sub
RollNo: 04613704409
Private Sub mdi_lbl_bck_Click()
On Error Resume Next
cmd1.ShowColor
frm_child1.lbl_1.BackColor = cmd1.Color
End Sub

Private Sub mdi_lbl_fnt_Click()


On Error Resume Next
cmd1.Flags = cdlCFBoth + cdlCFForceFontExist + cdlCFEffects
cmd1.ShowFont
frm_child1.lbl_1.FontSize = cmd1.FontSize
frm_child1.lbl_1.FontBold = cmd1.FontBold
frm_child1.lbl_1.FontItalic = cmd1.FontItalic
frm_child1.lbl_1.FontName = cmd1.FontName
frm_child1.lbl_1.ForeColor = cmd1.Color
End Sub

Private Sub mdi_lbl_fore_Click()


On Error Resume Next
cmd1.ShowColor
frm_child1.lbl_1.ForeColor = cmd1.Color
End Sub

Private Sub mdi_new_Click()


If filename <> "" Then
Open filename For Output As #1
Write #1, frm_1.txt_1.Text 'new file
Close #1
frm_1.txt_1.Text = ""
Else
frm_1.txt_1.Text = ""
End If
End Sub

Private Sub mdi_open_Click()


On Error GoTo err_msg
cmd1.ShowOpen
filename = cmd1.filename
Open filename For Input As #1
frm_1.txt_1.Text = Input$(LOF(1), #1) 'Open file
Close #1
mdi_save.Enabled = True
Exit Sub
err_msg:

MsgBox (Err.Number & "--" & Err.Description)


RollNo: 04613704409
End Sub

Private Sub mdi_paste_Click()


frm_1.txt_1.SelText = Clipboard.GetText
End Sub

Private Sub mdi_savas_Click()


cmd1.ShowSave
filemn = cmd1.filename
Open filemn For Output As #1
Write #1, frm_1.txt_1.Text 'save as file
Close #1
End Sub

Private Sub mdi_save_Click()


Open filename For Output As #1
Write #1, frm_1.txt_1.Text
Close #1 'save file
End Sub

Private Sub mdi_vert_Click()


Arrange vbTileVertical
End Sub

Private Sub MDIForm_Load()


mdi_save.Enabled = False
frm_1.Show
frm_child1.Show
End Sub

Screen shots
RollNo: 04613704409

Figure 9.1: Output screen on file save

Figure 9.2: Output screen for file open


RollNo: 04613704409

Figure 9.3: Output screen finding text

Figure 9.4: Output screen showing find text


RollNo: 04613704409

Figure 9.5: Output screen for changing font

Figure 9.6: Output screen after font change


RollNo: 04613704409

Figure 9.7: Output screen arrange cascade

Figure 9.8: Output screen for arrange vertical

You might also like