|
After trying everything, I've created new project and started to copy parts of my project in which error handling is broken ... And I've found out that my application catches all exceptions until this line:
req = CType(HttpWebRequest.Create(New Uri("http://test.com")), HttpWebRequest)
So what's the problem ? I don't think that I've did any thing wrong. Another interesting thing is that if I change my project to .NET framework 4.0 (currently it's 3.5), it works OK ... So is this kinda of bug in 3.5 or what ?
Thanks
|
|
|
|
|
Read this line from the docs;
Do not use the HttpWebRequest constructor. Use the WebRequest.Create method to initialize new HttpWebRequest objects. If the scheme for the Uniform Resource Identifier (URI) is http:// or https://, Create returns an HttpWebRequest object.
Based on this, you should be doing;
req = WebRequest.Create(), no need for any ctype.
|
|
|
|
|
I've tried to replace
req = CType(HttpWebRequest.Create(New Uri("http://test.com")), HttpWebRequest)
with
req = WebRequest.Create(New Uri("http://test.com"))
but the result is the same - program can't catch any error after that line ...
As for using CType, I must use it because I've turned strict on in my project
|
|
|
|
|
The event handlers for Application.ThreadException and AppDomain.UnhandledException have different parameters, so I doubt your code is correct as it uses a shared handler method. I suggest you check the documentation, fix the problem, and start your source files with Option Strict On .
|
|
|
|
|
In my last post I've told daveauld that I've turned strict on in my whole project
As for Application.ThreadException and Appdomain.UnhandledException, I know that they have different parameters, that's why I have overloaded ReportError sub, so that they booth can use it
Like this:
Public Sub ReportError(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs)
Try
MsgBox("Unhandled error has occured !!" & vbCrLf & vbCrLf & e.Exception.Message & vbCrLf & _ErrorTitle & " will now close.", _
CType(MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, MsgBoxStyle), _ErrorTitle)
WriteError(sender, e.Exception, "Yes")
If Not System.Diagnostics.Debugger.IsAttached Then
Application.Exit()
End If
Catch
End Try
End Sub
Public Sub ReportError(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs)
Try
MsgBox("Unhandled error has occured !!" & vbCrLf & vbCrLf & CType(e.ExceptionObject, Exception).Message & vbCrLf & _ErrorTitle & " will now close.", _
CType(MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, MsgBoxStyle), _ErrorTitle)
WriteError(sender, CType(e.ExceptionObject, Exception), "No")
If Not System.Diagnostics.Debugger.IsAttached Then
Application.Exit()
End If
Catch
End Try
End Sub
And I've told you, this is not working only in .NET Framework 3.5 (after creating HTTPWebRequest object)
Right now I've switched my project to .NET Framework 4.0, and the same code is working perfectly
|
|
|
|
|
Seems you know what you are doing then.
I use HttpWebRequest a lot and never had such issues; I mostly use C# and .NET 2.0 though.
Maybe Google can tell you about some bug that got solved in 4.0?
|
|
|
|
|
I've tried to google that, but can't find anything ... Well, I'm just happy that my app now works It could be that this doesn't happen in .NET 2.0 ether
Anyway, thanks for helping
|
|
|
|
|
i want to open POS cash drawer , which is connected to the POS Printer.
i want to open cash drawer without Printing means without consuming Paper , Is it possible to send Null or any character to the printer that it will not consume paper and will open
Cash Drawer
Note: cash Drawer can not be connected to any Port i,e; COM etc.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Chr(0) is ASCII NULL you could also try Chr(8) which is a audio beep
Steve Jowett
-------------------------
Real Programmers don't need comments -- the code is obvious.
|
|
|
|
|
Thanks for the reply
I tried chr(0) & Chr(8) both but it consumed paper , is there any why to move the Printer wheel/drum only but do not print anything
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Chr(13) - carriage return. Used to be used to move printer head to left margin without feeding paper.
Don't know if it will work for your printer. Some printers had a DIP switch that could be set to allow them to interpret Chr(13) as Chr(13)+Chr(10) pair.
Or is it possible to just not send anything to the printer?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
How are you sending the string to the printer? I would suggest that you would need a Write rather than a WriteLine command as a WriteLine with include a Carriage Return and Line Feed.
Steve Jowett
-------------------------
Real Programmers don't need comments -- the code is obvious.
|
|
|
|
|
Steven J Jowett wrote: Chr(8) which is a audio beep
I think that is a back-space character... (7) is beep, if I remember right.
|
|
|
|
|
here is a shocking thought: the manufacturer could have hidden such information in some manual. Did you check?
|
|
|
|
|
wow, do manufacturers produce manual, sheesh, the next thing is they will be creating websites with forums, faq's and KB's....
|
|
|
|
|
It may very well require a series of codes to open the drawer. Have you tried this web site?
http://pages.prodigy.net/daleharris/popopen.htm[^]
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
got any solution for this? i facing the same problem, i got the drawer code, but i duno how to implement it.
Cash Drawer code: 27, 112, 0, 100, 250
|
|
|
|
|
Best and fastest way to implement this contact the Manufacturer of printer and ask them to give SDK. after hectic effort i had got the SDK from the Manufacturer.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Hi everybody
I have been with this forum for sometime but this is the 1st time i post a question and is not sure if this the right place to start this question.
I am tinkering to build a vb.exe wherein it will communicate with a Pansonic PABX telephone system through a USB or Com port using the MSComm object. The objective here is to pick up the data coming from the PABX such as time of call, duration, destination number and costs of call plus sending out data to tell the various extension to ring at certain predetermined time or to bar the extension.
It is said that Telephony Application Programming Interface (TAPI) is a Microsoft Windows API, which provides computer telephony integration and enables PCs running Microsoft Windows to use telephone services can do do the job.
This being the first time i tinker into communication issues i am not sure if using the msComm is the right step. I feel that TAPI is a more complex way to go.
More importantly i am not sure what protocol the PABX will work on. My attempts to talk to Panasonic company on this had not been too fruitful.
Any pointers from members of this forum will much appreciated.
modified on Wednesday, July 21, 2010 1:08 AM
|
|
|
|
|
What is the model of the PABX?
I doubt TAPI is the way to go, that will be more for actually placing calls,sending fax's etc.
I would imagine it would use a serial protocol via a usb or DB-9/RS232 port.
This site ( http://www.pbxguru.com/[^] )makes reference to programming software etc. for panasonic exchanges, so it must be possible, hence the reason for asking the model.
The may use some strange non-standard protocol i.e. the actual message send and received by the unit, and it maybe is not in the public domain. and the port is used by their own software.
Until you provide the model, it would be difficult to determine how it is done.
|
|
|
|
|
Thanks Dave
The model was Panasonic KX-TD500, but the new version is now TDA200ML.
I am comfortable with rs232 port as i have tinkered with the comm1 object properties & events namely .portOpen, .commEvent & .input via the reference mscomm32.oca.
I have no actual experience communicating with a PABX. I need to understand the string to send to & from and all the properties / parameters in the system.
I had a look at your proposed link and was reading the "help" from the programmer application for KX-TD500 and just wondering if it can handle the new TDA200ML. Are you in any way related to the info@voicecallcentral.com?
Thanks again & waiting for further advice.
modified on Friday, July 23, 2010 12:32 AM
|
|
|
|
|
Hi,
I add a checkbox in a datagridview that is an unbound column. Onload it is an unchecked state, when I click on it, I get this error message Index -1 does not have a value. I am lost..
what i want to do is to able to check and uncheck the checkbox to do insert, delete current row selected...
Can anyone guide me please..
thanks advance
|
|
|
|
|
Then probably your row contains no (actual) data.
But why use a checkboxcolumn for this and not .SelectedItems ?
|
|
|
|
|
Hi Friends,
I am converting an excel to xml using vba. THere this excel data having &. But when converting & to xml it is giving error. So I am using the following funtion to replace &.
Function RemoveAmpersands(AnyStr As String) As String
Dim MyPos As Integer
' replace Ampersands (&) with plus symbols (+)
MyPos = InStr(1, AnyStr, "&")
Do While MyPos > 0
Mid(AnyStr, MyPos, 1) = "+"
MyPos = InStr(1, AnyStr, "&")
Loop
End
But the above function replacing with +. But I wanted to display in the browser as & only. Kindly Help.
Regards,
Priya.
|
|
|
|
|
Would using & fix the problem?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|