Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Creating Public Methods vs. Using Show Directly

Question:
The program I am writing has two menu items for displaying say, autoexec.bat and config.sys respectively. I would like to make it so that they only need to call a form which contains a rich text box to display the files, but I didn't know how to tell the form what file to display upon invoking it (using show method) from the two menus.

Answer:
Actually, since you're using VB 4.0, you can create a public method on your form that can be used instead of the Show method. For instance: In the file display form:

Public Sub ShowFile(sFilename as String)
        
   Me.Show   ' will display form
   ' Code to load file into text box or whatever goes here

End Sub
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date