Browse DevX
Sign up for e-mail newsletters from DevX

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Creating Public Methods vs. Using Show Directly

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.

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.



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