I wasn't checking the state properly, you need to send the command over and over until it returns success that's what the documentations says, also the enum TxFiscalState DOES NOT WORK ON 64 bit computers at all so stop trying, at least with the library I was using it didn't.
Very strange issue with read only property from ocx library?
سؤال
First of all, thanks for taking your time to take a look at my post, and help me get over this problem that I have.
I have searched, read a lot of posts and I haven't found a good answer, and my codes keeps failing, here's my situation: I have an OCX library (.ocx file) and I'm adding that reference to my VB.NET 2008 application as MSDN suggested, that library is suppose to send commands to a printer, perfect I can open my port and send my commands perfectly, however what's happening is that before I send the next command I have to wait until the printer change its state ( from Busy to Idle ), but I can't get a code where it waits correctly, I want to make sure if the problem is with the library or my code so I added a watch to that variable to see if it's really changing and it is doing it, so I don't have an idea of what's going on here, let me your you my code:
AxEpsonFPHostControl1.CommPort = EpsonFPHostControlX.TxCommPort.Com1 'Set my com port
AxEpsonFPHostControl1.BaudRate = EpsonFPHostControlX.TxBaudRate.br9600 ' set my baud rate
AxEpsonFPHostControl1.ProtocolType = EpsonFPHostControlX.TxProtocolType.protocol_Extended
AxEpsonFPHostControl1.OpenPort() ' I open my port
OpenTicket(params) ' Here I send a command, you can ignore the parameters
FPDelayNew() ' Here I TRY to create a delay that waits until the printer change from busy to Idle
SendItem(params) ' Here I send a command, you can ignore the parameters
FPDelayNew() ' Here I TRY to create a delay that waits until the printer change from busy to Idle
AxEpsonFPHostControl1.ClosePort()
I have tried a lot of things, one of the things that I tried was this: Just so you know AxEpsonFPHostControl1.CtlState
is a
Public Overridable Readonly Property CtlState() As EpsonFPHostControlX.TxFiscalState according to visual studio when I hover over.
And
EpsonFPHostControlX.TxFiscalState.EFP_S_Busy
is just an enum when EFP_S_Busy is 2
This is how I tried the delay:
Public Sub FPDelayNew()
While AxEpsonFPHostControl1.CtlState = EpsonFPHostControlX.TxFiscalState.EFP_S_Busy
System.Threading.Thread.Sleep(0)
End While
End Sub
It doesn't work at all, sometimes the program will just execute this method fastly, or if I use a break point the application will just hang when I run this method step by step, so I don't have a clue of that's going on.
I already tried a watch to check if AxEpsonFPHostControl1.CtlState was not changing it's state, and it's doing it.
Tried with an event, and the same, tried with a do until..loop and the same, I hope I can find someone who can help me with this, best regards!
I finally found a solution, if you need help with this library you can contact me luisarmando.molina@yahoo.com
المحلول