Hi All, I am sure that i am at correct place for thread ?, I didnt found a VB section. I have a little programme that prints directely to the printer through LPT port, what i want is that, when the form is filled up with details and ready to print, it should create a .TXT file and make a entry of data. and in next time it should open the same .txt and enter the data in the next line, probably below it. Can some one help is general ? I am able to put the text file but i am unable to reopen and write the data in it. Help would be really appreciated. Regards Raghav
chapicha : you are correct, but now it seems that i am traped up somewhere else. Print command to LPT is working awsome to the printer, but I dont know code to send command to USB. I am using type c:\Prt.txt >lpt1 Code (markup): when i swap LPT to USB..doesnt work (I knew it wont, just giving it a try ) So any ideas how to proceed up ?
LPT and USB is different port, if you use type command it just print the output to lpt1 and what about usb ? so better u use the printer object of vb. because the printer object use the windows printer. don't care if usb, lpt or network printer.
Yes i can understand that, but i have used the printers code to set up a form and push command to LPT to give those codes to the printer, I was just wondring if any how the command can be send to USB ? Yes but then it will send to all ports of the PC ? and here we have more then 2 printers on a PC, wont it print on all ? or did i understood wrong what you have said ?
it use your default printer. you can set the default printer on windows control panel printer. or in code. Dim w As New WshNetwork w.SetDefaultPrinter (â€ThePrinterYouWantâ€) Set w = Nothing Code (markup): you can read here for more tutorial on printing http://www.devarticles.com/c/a/Visual-Basic/Printing-With-Visual-Basic/3/ u need to add referenced to Windows Script Host Object Model (/system32/wshom.ocx)
iwyrobi The code did not work, dont know if i am doing something wrong. Isnt there any way simple like the one for LPT ? to through command to USB ? Secondly, As per your previos code, I was able to append and save, but can i make the data non editable or the txt file that cannot be deleted ?