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 thatthey only need to call a form which contains a richtext box to display the files, but I didn’t knowhow 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 hereEnd Sub

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: