Site hosted by Angelfire.com: Build your free website today!
Visual Basic



*NOTE: i am not responcible for the misuse and/or adverse affects of the provided source code and/or Visual Basic Applications, USE AT YOUR OWN RISK.

Source Code

The Printer function
Printer.Text "text here " & text1
This will print the text inside the quotes and the text in text box1.

Printer.EndDoc
Tells the printer that the document is done (its a good idea to add this to prevent printer malfunction)

Printer.KillDoc
This Will cancel a printing job.
Set Printer Margins
Use the Printer's scale properties to set margins. Set the properties so the position (0, 0) is mapped to where you want the margins. For example, the following code makes the left margin 0.5 inches and the top margin 0.75 inches. The factor of 1440 converts inches into twips.
Printer.ScaleLeft = -0.5 * 1440
Printer.ScaleTop = -0.75 * 1440
Printer.CurrentX = 0
Printer.CurrentY = 0
Unfortunately printers don't print exactly where you think they should. Try using this statement to print a box 1 inch from the upper left corner: Printer.Line (1440, 1440)-Step(1440, 1440) See how far off it is. Try printing several times. If your printer is consistently off by some amount at the top and left, you may be able to get good results by subtracting these amounts from the margins you set.

Form Fade
Ever wondered how the install wizards get there forms to fade from a dark blue to a lighter color? well here it is...

Sub Dither(vForm As Form)
Dim intLoop As Integer
vForm.DrawStyle = vbInsideSolid
vForm.DrawMode = vbCopyPen
vForm.ScaleMode = vbPixels
vForm.DrawWidth = 2
vForm.ScaleHeight = 256
For intLoop = 0 To 255
vForm.Line (0, intLoop)- (Screen.Width, intLoop -
1), RGB(0, 0, 255 - intLoop), B
Next intLoop
End Sub

Private Sub Form_Activate()
Dither Me
End Sub

Just add the previous section of code to a standard EXE. To change the color of the faded form background just change the RGB(Red Green Blue) function values.

Wait Function
Here is a accurate and easy way to make a set of Commands "Wait". To use this code you will need: A timer(Timer1), a Command Button(Command1), and 2 labels(label1 and label2).

Public Sub Wait(seconds)

'-- Turn timer on
Timer1.Enabled = True

'-- Set Timer Interval
Me.Timer1.Interval = 1000 * seconds
While Me.Timer1.Interval > 0
DoEvents
Wend

'-- Turn timer off
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Timer1.Interval = 0
End Sub

For Example...

Private Sub Command1_Click() Label1.Caption = Now
Wait (5)
Label2.Caption = Now
End Sub

If you have source code that you would like posted here then it to me, along with a description of what it does and anything else you would like to include.


Applications

WAW1.1
When opened the form remains invisible and sends the text "We are watching..." to the computer's printer. Great prank program.

Author: izy
Date Added: 3/30/00
Size: 2.82kb


Download WAW1.1

Pocket Calculator1.1
A program with basic calculator functions, but when you press the equals button it saves the value in a list box. Really kewl program and very time saving.

Author: izy
Date Added: 3/30/00
Size: 3.3kb


Download PocketCal1.1