Solved

MDI NotePad Program

Posted on 1998-04-28
4
363 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

724 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