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
Aug 6, 1997

Talk About Reusable Code!

In VB4 you can create a single Splash Screen or About Screen that works with any program and automatically keeps itself up to date using the new properties of the App Object. Create your form and make an attractive arrangement of label controls on it. Then add code such as this to the Load Event:
 Label1.Caption = App.ProductName
Label2.Caption = App.FileDescription
Label3.Caption = "Version " & App.Major & "." _
	& App.Minor & "." & App.Revision _
	& " (" & Format$(FileDateTime(App.Path & "\" & _
	App.EXEName & ".EXE"), "Short Date") & " - " & _
	(FileLen(App.Path & "\" & App.EXEName _
	& ".EXE")) & " bytes)"
Label4.Caption = App.LegalCopyright
Label5.Caption = App.CompanyName
Label6.Caption = App.Title
Label7.Caption = App.LegalTrademarks
Label8.Caption = App.Comments
For graphics you can use your company's logo or put a blank PictureBox on the form, create the graphic as a separate file, and add this code to the Load Event:
 Picture1.Picture = LoadPicture(App.Path & "\logo.bmp")
There are two cautions, however:
  • Until the first time you compile your code, there will be no EXE file, so the FileLen and FileDateTime functions will fail. To avoid this problem, create a dummy file with the project name EXE.
  • If any of the referenced App properties are not set the form will load fine in the development environment but will generate the run time error "Resource with identifier
Daniel R.
 
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