VB FlashText

What does this code do?

This is a user friendly idea for a useful pop up 'post-it' style note, usable anywhere in your programme. The note disappears as soon as you click anywhere else on the screen. It uses an edit box so that the contents can be copied by the user.

I use it for displaying SQL commands or helpful information, a bit like giant tool tips.

How do I integrate it with my existing code?

Most of the time I create a button for the user to press whenever they want the additional information. I have a standard bitmap which represents information, within my apps. or (BMP files for download and use in your own apps.)

Is there any similar code?

There are probably lots of examples of similar code available. I didn't look before I wrote my own.

How do I do that?

Include the form called 'frmFlashText' in you application. It is only a multiline edit box exactly the same size as the form. Whenever it looses focus, it unloads it'self. Call it from a button as follows.




Private Sub btnInfo_Click()

    strYourText = "Your text goes here"

    LoadFlashText strYourText

End Sub



Sub LoadFlashText(strText As String)

    Dim frmFlash As frmFlashText

    Set frmFlash = New frmFlashText

    frmFlash.edtFlashText = strText

    frmFlash.Show

End Sub



If you want to add specific line feeds to arrange the text then insert a carriage return + linefeed pair, as follows:



Public CRLF As String

CRLF = Chr(13) & Chr(10)



LoadFlashText strYourFirstParagraph & CRLF & CRLF & strYourNextParagraph



What controls and DLLs does it need?

None.

What version of Visual Basic was the code built with?

I am using Visual Basic 5 Professional with Visual Studio service pack 3 installed.

Assistance?

If you have any questions, comments or improvements, please e-mail me. I can't promise to answer all mails, but I do read them all and I will try to help if I have the time.

John C. Brown, 1998, http://www.clue.demon.co.uk