Solved

MDI NotePad Program

Posted on 1998-04-28
4
335 Views
Last Modified: 2011-10-03
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
Comment
Question by:Millos
  • 3
4 Comments
 
LVL 1

Accepted Solution

by:
chualk earned 10 total points
ID: 1433376
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
 
LVL 1

Expert Comment

by:chualk
ID: 1433377
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
 

Author Comment

by:Millos
ID: 1433378
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
 
LVL 1

Expert Comment

by:chualk
ID: 1433379
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now