borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (vb file print)Next Topic (Printing problem in VB on Dot Matrix Printer) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Print method is not avaliable
Poster Message
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907

icon Print method is not avaliable

Hello you all.
As in the object, Printer.Print method is not avaliable in my code. Intellisense doesn't list it, and if I write it, I get an error of Not Supported Property or Method when run.
Does anybody know why?


____________________________
Real Programmer can count up to 1024 on his fingers

10-01-2004 at 11:53 PM
View Profile Send Email to User Show All Posts | Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: Print method is not avaliable

As to why the print method is not displayed by intellisense:

The syntax of the Print method is so unstructured that it cannot be represented by any syntax convention in use today. Consider that you can separate using comma(,), semi-colons(;) and have these at the end of the statement.

For instance:
'This is valid
obj.Print
obj.Print "The print statement is wierd"
obj.Print "It behaves funny";
obj.Print " The time now is", Now
obj.Print 1,2,3;4,5,"ADFA",9;


This however is invalid:
MsgBox "The message"; "Something else"


As for why it is not working, I cannot say exactly. I think it would depend on what your code was trying to do.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

11-01-2004 at 05:13 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: Print method is not avaliable

Dim str as string
str="My string is created here"
Printer.Print str


The word Printer is written in blue (my setting for object and variable names), but the word Print is black, as a variable value.
It seems the Print method is unknown to VB, at least for the Printer object.
A doubt: could it depend on the On/Off status of my default printer? Didn't try it, but it seems so uninfluent...

____________________________
Real Programmer can count up to 1024 on his fingers

12-01-2004 at 09:44 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Print method is not avaliable

Printer object in VB doesnt have Print method

Quoted from MSDN:

Use graphics methods to draw text and graphics on the Printer object. Once the Printer object contains the output you want to print, you can use the EndDoc method to send the output directly to the default printer for the application.

Graphics methods are Circle, Cls, Line, PaintPicture, Point, Print, and PSet. They are not present in intelisence, but U can use them.

[Edited by Goran on 12-01-2004 at 06:49 PM GMT]

____________________________
If you find the answer helpful, please mark this topic as solved.

12-01-2004 at 12:35 PM
View Profile Send Email to User Show All Posts | Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: Print method is not avaliable

That's funny,

I have the reverse of what you have, yronium. I tried to run some code on my machine and the word printer is in black, the word print is in blue. You could be right about the default printer stuff. I will give it a shot right now and see.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

12-01-2004 at 03:38 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: Print method is not avaliable

Now I have more wierd behaviour. My computer won't let me remove a default printer. It seems I must have a default printer at all times.

You might have to check that you have a printer properly set.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

12-01-2004 at 03:46 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Print method is not avaliable

If printer is not installed, it will display:

Run-time error '482'

Printer error

I dont have attached any printer on my comp, I only installed driver for printer (type not important), and it works.
I believe that you always have to have default printer, cause I think it works like option buttons, one always have to be selected. If you delete driver for default printer, it will pick another to be default if any installed. At least this is how it works on WinXP, not sure about Win98.

____________________________
If you find the answer helpful, please mark this topic as solved.

12-01-2004 at 06:04 PM
View Profile Send Email to User Show All Posts | Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: Print method is not avaliable

I agree with you Goran. It works fine on my WinXP machine but I cannot figure out why it would behave like that for yronium.

yronium, you might want to try the Microsoft Knowledge base to see if this is an issue with VB.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

12-01-2004 at 08:17 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: Print method is not avaliable

No, I guess I'll try to run the code anyway. Since Goran said I could use the Print method like the Circle, Pset and other I'll try running it anyway. The worst case I'll get an error.
I hadn't time to try it before, I'll let you know.
Thanks for the moment

____________________________
Real Programmer can count up to 1024 on his fingers

13-01-2004 at 12:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : Print method is not avaliable
Previous Topic (vb file print)Next Topic (Printing problem in VB on Dot Matrix Printer) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder