Avatar billede c.aa.t Nybegynder
03. september 2001 - 08:23 Der er 16 kommentarer og
1 løsning

Hjælp til printfunktion

Hej! Jeg har et problem med at få mit program til at lave linjeskift når jeg skal printe ud! Det printer bare uden for papiret!! Hvad gør jeg?? Min printkode ser således ud, lidt langsom, men den virker!!

Private Sub cmdprint_Click()
svar = MsgBox(\"Udskriv side?\", 4, \"slet post\")
If svar = 6 Then
Printer.Print \"  \"
Printer.Print \"OTS SKP NOTA\"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"Opgavenr:\"; \"        \"; txbopgnr.Text
Printer.Print \"Dato Start:\"; \"      \"; txbdatostart.Text
Printer.Print \"Prioitet:\"; \"        \"; txtprio.Text
Printer.Print \"Deadline:\"; \"        \"; txtdeadl.Text
Printer.Print \"  \"
Printer.Print \"              _______________________________________________________________\"
Printer.Print \"  \"
Printer.Print \"Type:\"; \"            \"; txttype.Text
Printer.Print \"Modtaget Af:\"; \"    \"; txtmodt.Text
Printer.Print \"Ansvarlig:\"; \"      \"; txtansv.Text
Printer.Print \"Afdeling:\"; \"        \"; txtafdel.Text
Printer.Print \"Lokalitet:\"; \"      \"; txtloka.Text
Printer.Print \"  \"
Printer.Print \"              _______________________________________________________________\"
Printer.Print \"  \"
Printer.Print \"Fejlraport:\"; \"      \"; txtbopgmodt.Text
Printer.Print \"              _______________________________________________________________\"
Printer.Print \"  \"
Printer.Print \"Opgave Færdig:\"; \"  \"; txtopgaflev.Text
Printer.Print \"              _______________________________________________________________\"
Printer.Print \"  \"
Printer.Print \"Kontakt:\"; \"        \"; txbkont.Text
Printer.Print \"Ring:\"; \"          \"; chkring.Value
Printer.Print \"Tlf:\"; \"            \"; txbtlf.Text
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"                \"; \"Underskrift\"
Printer.Print \"  \"
Printer.Print \"  \"
Printer.Print \"              \"; \"------------------ \"
Printer.EndDoc
End If

End Sub

Nogen der har et forslag??
Avatar billede c.aa.t Nybegynder
03. september 2001 - 08:25 #1
Det er fejlrapport og opgave færdig som der er bøvl med


Avatar billede terry Ekspert
03. september 2001 - 09:27 #2
c.aa.t> Dont you think you should have a reference to the previous question on this matter?

http://www.eksperten.dk/spm/103156

The answer I gave there works on my PC, so I would think you are not entering the code correctly.
Avatar billede c.aa.t Nybegynder
03. september 2001 - 12:23 #3
But i tried it, and it did\'nt work on mine...
And i asked what could have caused it, but no one answered! I proberly typed the code wrong then...
Avatar billede terry Ekspert
03. september 2001 - 12:29 #4
c.aa.t In the other question you say:
I keep getting errors!
Private Sub cmdprint_Click() is highlighted

This indicates that something is wrong in your code. You can comment out all lines and then one line at a time remove the comment. This way you should be able to locate what is wrong.

Avatar billede joern Nybegynder
03. september 2001 - 18:34 #5
Jeg går ud fra at det er i bredden at der printes udenfor, ikke i højden.
Du må jo begrænse længden af hvad det er muligt at indtaste i alle de tekstfelter.
I øvrigt kan man få pæne kolonner med anvendelse af \"tab\".

printer.print \"Ledetekst\";tab(12;mitfelt.text

Hvis du har tekster, der er så lange at de skal bruge flere linier, bliver det indviklet, men muligt.

Du skal i så fald dele linien f.eks. ved den sidste ascii(20) før tegn nr. 80.

Spørg igen hvis du har brug for den slags.

M.v.h.  Jørn
Avatar billede terry Ekspert
03. september 2001 - 20:02 #6
c.aa.t> If you cant find your error then send the VB project to (zipped).

dkTebrsa@Europe.lego.com (.com) is part of the hyperlink

mvh
terry
Avatar billede terry Ekspert
04. september 2001 - 19:55 #7
your program is on its way!
Avatar billede c.aa.t Nybegynder
06. september 2001 - 11:08 #8
Have You used VB 6 or VB 5?? Im using VB 5 and i can\'t open it!! And if i copy the print code into my program, then errors occur at \"Lineformat\"??
Avatar billede terry Ekspert
06. september 2001 - 11:17 #9
VB6, but I cant see what that has to do with it!

Try re-naming LineFormat to MyLineFormat. You have to do this in your cmdPrint_Click and also in the module. Then try compiling the program to an EXE file.
Avatar billede c.aa.t Nybegynder
06. september 2001 - 12:31 #10
What do you mean by \"Module\"?? Sorry for understanding so litlle but i am very new in this
Avatar billede terry Ekspert
06. september 2001 - 12:39 #11
In your project you have forms and also modules. You can add pieces of code to a module which can then be used from all forms for example.
You should find a module with th ename module1. In this module there is a function called LineFormat which you should try to rename to MyLineFormat.
Avatar billede c.aa.t Nybegynder
06. september 2001 - 13:57 #12
I can\'t find the module anywhere.....
Avatar billede terry Ekspert
06. september 2001 - 15:26 #13
are you sure you are looking at what I sent. I have just checked my sent mail and its there!

If you look in the ZIP file there is a file named module1.bas. The function is in this. I would suggest that you copy all the files to a new folder and then start by clicking on the .vbp file.
Or when you extract the files from the zip file it must overwrite the existing files or the project will not know that the .bas file is in the project.

Avatar billede terry Ekspert
06. september 2001 - 15:29 #14
I have sentt you a mail!
Avatar billede terry Ekspert
15. september 2001 - 16:11 #15
c.aa.t hows things going?
Avatar billede terry Ekspert
20. september 2001 - 14:27 #16
c.aa.t> Are you there?
Avatar billede terry Ekspert
04. oktober 2001 - 21:02 #17
c.aa.t How about answering this question!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



IT-JOB

Cognizant Technology Solutions Denmark ApS

Kinaxis Solution Architect

Capgemini Danmark A/S

Network Architect

Cognizant Technology Solutions Denmark ApS

Test Manager

IT & Co ApS

Systemkonsulent