[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

MDI NotePad Program

I am creating an MDI notepad program with a difference:  Each new notepad that is started is in a different font.  The name of the font is also given as the caption of that child form. 

The only items on the "File" menu are "New" (Which created a new child window) and "Exit". 

I am trying to figure out how to code a different font when a new notepad is created and giving the font name as the caption of that child form

TIA
Alexander
0
Millos
Asked:
Millos
  • 3
1 Solution
 
chualkCommented:
Try this :

Create an mdi form with menuname MDI_MNUFILE.
Create a form name frmNEWNOTEPAD

Declare in Module:
Public Index as integer

Private Sub MDI_MNUFILE_Click()
   
       Dim count As Integer

       count = Printer.FontCount
       index = (index + 1) Mod count

      Load frmNewNotePad
      frmNewNotePad.Show
      frmNewNotePad.Caption = Printer.Fonts(index)
      frmNewNotePad.RichTextBox1.Font = Printer.Fonts(index)


End Sub
0
 
chualkCommented:
Oops :

I left out 1 thing.
Replace the code with this:



     Private Sub MDI_MNUFILE_Click()
         
            Dim count As Integer
            Dim form as new frmNewNotePad


            count = Printer.FontCount
            index = (index + 1) Mod count

           Load form
           form.Show
           form.Caption = Printer.Fonts(index)
           form.RichTextBox1.Font = Printer.Fonts(index)


     End Sub

0
 
MillosAuthor Commented:
Thanks Chualk's.  I do have one question:  I get a compile error "method or Data not Found" when I run the program and create new Child Notepad.  The line that it highlights is the following:

            Form.RichTextBox1.Font = Printer.Fonts(index)

The word .RichTextBox1 is highlighted in Yellow.
Do I have to declare RichTextBox1 anywhere or put a text box named richtextbox1?

Thanks!!
0
 
chualkCommented:
Hi:

RichTextBox is a control. You can add it by go to project-> component. There you will see a control named richtextbox. It is a control similar to textbox but it's special in its ability to format text into different fonts, size and style. For detail, please read the help file.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now