|
-
Nov 10th, 2008, 04:59 PM
#1
Thread Starter
New Member
Printer Ideea
Hey,
I need to know if there is any way that I can print a medical analisys report
in visual basic:
I have a form made with a lot of text boxes and a print button. When I press the print button I want the values from the text boxes to be printed. This is simple but formatting them is giving me problems. Example:
Analyst Result Normal Values Analyst Result Normal values
--------------------------------------------------------------------------
Thymol Text1 2-4UML Prot C. Reactive TExt2 absent
The main problem is that if I enter in Text1 a bigger value or something it will scramble all the allign. Some ideeas?
-
Nov 10th, 2008, 07:09 PM
#2
Re: Printer Ideea

You can use Printer.CurrentX to print at "column" locations. e.g.
Printer.Print "Thymol ";
Printer.CurrentX = 900
Printer.Print "some value"
You may know this but the semi-colon causes the two things to be printed on the same line.
-
Nov 10th, 2008, 07:21 PM
#3
Thread Starter
New Member
Re: Printer Ideea
Hello MartinLiss,
first of all thank you very much for your reply.
I have learned a little about datagrid and if I Insert data from a textbox to a datagrid how do I print it? It will arrange the text in a more ordonated formating?
If I use Printer.CurrentX what is the maximum value I can use? I mean what is the value that will mark the edge of the papaer? (I have wasted approx 200 A4 papers, I don't want to kill the forest anymore
Tahnk you
-
Nov 10th, 2008, 07:30 PM
#4
Re: Printer Ideea
"I have learned a little about datagrid and if I Insert data from a textbox to a datagrid how do I print it?" - You could do me.PrintForm but that may not be satisfactory since all the data would need to be visible and then you'd also have to first temporarily hide any controls that you didn't want in the picture.
If I use Printer.CurrentX what is the maximum value I can use? - Offhand I don't know, but please reinsert the printed pages and/or turn them over and/or upside down
-
Nov 11th, 2008, 03:45 AM
#5
Re: Printer Ideea
maximum value for currentX is printer.scalewidth
anything printed at that position would move on to the next line
i suggest using a pdf printer driver for testing purposes, you can just view on screen then overwrite for next test, test on real paper when the pdf is correct
you have to work with the printer.textwidth to align your text into columns
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 11th, 2008, 01:09 PM
#6
Thread Starter
New Member
Re: Printer Ideea
Ok. Thank you very much for your help.
If I want to print in Visual Basic 2008 (I think is .net) a simple Hello world, what I must do? becase I have investigated this and is more complicated than printer.print Is something with documentprint. Can you provide me some kind of example on how to simply print on paper hello world? I have made it with the tables but I need to print Something else on the page.
Thank you again
-
Nov 11th, 2008, 01:30 PM
#7
-
Nov 11th, 2008, 01:51 PM
#8
Re: Printer Ideea
 Originally Posted by playplayply
If I use Printer.CurrentX what is the maximum value I can use? I mean what is the value that will mark the edge of the paper? (I have wasted approx 200 A4 papers, I don't want to kill the forest anymore
Tahnk you
Use the PrintPreview dialog for printing tests, never ever use paper for all of the testing
-
Nov 11th, 2008, 02:30 PM
#9
Thread Starter
New Member
Re: Printer Ideea
OK. But how can I print Hello world on the paper?
-
Nov 11th, 2008, 04:10 PM
#10
Re: Printer Ideea
Drop a PrintDocument on the form, double click it now in the code window you'll see a PrintPage event has been put in, use e.Graphics.DrawString() to draw the text on the page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|