Click to See Complete Forum and Search --> : Form As Text?
January 8th, 2000, 02:53 PM
I am a beginning VB student and learning this intersting program. My Teacher is asking on his lab 4 things he wants.
1>Program Code (thats easy thats just the coding I got that)
2>Program Forms<Form Image> (if I am correct I made a cap file of the screen before it was run>
3>Form as Text <no idea what this means help!!!>
4> 3 Output screens <means caps of 3 different test runs ...no prob>
So if any of you out there can help me with #3 and 2 if I have that wrong that would grately be appreciated. Thanks.
wilton
January 8th, 2000, 03:02 PM
you really should ask you prof if you need help with what he wants. But to get a form to text you need to go to File then Print and you'll see an option for printing forms to text
AndyK
January 9th, 2000, 05:32 PM
Set form properties to autoredraw = true
or just place this code into a Form_load()
me.AutoRedraw = true
print "Hello"
I have one question tho, can you tell VB to print "Hello" in the center for example?? or it's imposible to tell VB to print text somewhere else but top-left corner (0,0)
wilton
January 10th, 2000, 12:04 AM
you could always create a label and dynamically move the label at run time.
Chris Eastwood
January 10th, 2000, 02:51 AM
>I have one question tho, can you tell VB to print "Hello" in the center
>for example?? or it's imposible to tell VB to print text somewhere else
>but top-left corner (0,0)
You need to mess around with the Form's 'CurrentX' and 'CurrentY' properties (the printer and picturebox have these properties also).
Note that this code doesn't take into account the height of the windows caption bar so it may appear as if the height isn't centered properly (although it is in client/space terms).
Dim sText as string
'
sText = "Hello World"
'
' You will need to take into account the standard
' form caption bar height if you want it to appear
' 'dead' center - this just places it in the center
' of the available area
'
me.CurrentX = (me.Width / 2) - (TextWidth(sText) / 2)
me.CurrentY = (me.Height / 2)
'
me.print sText
'
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Chris Eastwood
January 10th, 2000, 03:03 AM
You can simply load the vb form file into notepad and print it out that way (or just save it as a 'txt' file).
In VB3 (and 4 ?) there used to be an option for saving forms in a binary format but this used to go horribly wrong sometimes. Now all VB files in your project are saved in a text-based format (at least, I can't find the option to save as binary anywhere).
As for the screen capturing, simply do a CTRL or ALT and PrintScreen (depending on what you want to do!) and paste into PaintBrush / PSP / Word or a similar package.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.