Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
any help is appreciated.

printing is not happening. i am using the following code to print the bill which is generated and located in the release folder named as salesbill.txt. both files(batch file and txt file) are there in folder(G:\ANIYAN\Projects\silentproject\bin\Release) after generating bill. but it is not come into print. what is the reason?
if i print directly a


VB
           Dim hFile As Long

'call funtion for make a format in print page and content and add in print()
'example 
'Print(hfile, ManageSpace("Receipt No: " + ds.Tables(0).Rows(0).Item("RR_Number").ToString, 20, 1))


          hFile = FreeFile()

          Dim StrFile2 As String

          StrFile2 = strAppPath &"\salesbill.txt";
'StrFile2=G:\ANIYAN\Projects\silentproject\bin\Release\salesbill.txt
          FileOpen(hFile, StrTmpReportBatFile, OpenMode.Output)
          Print(hFile,"TYPE"&StrFile2 &">prn")

          FileClose(hFile)
          Shell(StrTmpReportBatFile, AppWinStyle.Hide)
Posted
Comments
[no name] 22-May-15 9:02am    
What do you mean "printing is not happening"? Do you mean that when you use the Print function that writes output to a file that it's not magically printing to a printer? Why are you not using the PrintDocument class?
aniyan.c 22-May-15 10:15am    
actually it was a running project. not done by me, almost 5 years back it has done. i meant that it doesn't print anything. and i am trying to solve the issue.
[no name] 22-May-15 10:24am    
If it *was* working and now suddenly it's not, you need to figure out what changed and correct it. We can't do that for you.
aniyan.c 22-May-15 11:00am    
client said list of modification . i had updated it. printing functionality i didn't changed. and the running exe formatted from client. so i need to solve this. path of printing file is correct. and i want to know is any other thing will affect this printing. i mean firewall or something. if anyone know the code which i wrote above. please cross check. i want to know the method i wrote is correct or not.

1 solution

Or using dos command :
VB
Dim monProcess As New Process()
 monProcess.StartInfo.FileName = Chemin
 monProcess.StartInfo.Verb = "Print"
 monProcess.StartInfo.CreateNoWindow = True
 monProcess.Start()
 
Share this answer
 
Comments
aniyan.c 22-May-15 10:18am    
what is "Chemin"?
i just want to print a textfile. so i think open the location and print will happen with "prn" function in vb.
aniyan.c 22-May-15 10:18am    
i don't know much about vb methods. so don't think anything if i said wrong.
aniyan.c 23-May-15 2:54am    
Than you very much @Stephane1984.
it is working fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900