I have Class1 which performs some data calculations on
System.Timers.Timer.Elapsed event.
Public Class Class1
Private WithEvents tmrReadSerialData As New
System.Timers.Timer
Public Sub New()
tmrReadSerialData.Interval = 1000
End Sub
Public Sub StartIt()
tmrReadSerialData.Start()
End Sub
Public Sub StopIt()
tmrReadSerialData.Stop()
End Sub
Private Sub tmrReadSerialData_Tick(ByVal sender As
System.Object, ByVal e As System.Timers.ElapsedEventArgs)
Handles tmrReadSerialData.Elapsed
' This line should throw an exception because of
' different culture setting (2.54 in spite of 2,54)
' but it doesn't, exits sub and Beep is not performed
Dim a As Double = Double.Parse("2.54", New
Globalization.CultureInfo("pl-PL"))
Beep
End Sub
Public Sub Test()
' Ta linia nie powoduje błędu - konwersja liczby
zapisanej w ustawieniach regionalnych USA
Dim b As Double = Double.Parse("2.54", New
Globalization.CultureInfo("en-US"))
Dim a As Double = Double.Parse("2.54")
Beep()
End Sub
End Class
When I use this object from my WinForm and click button
which performs Class1.StartIt, tmrReadSerialData_Tick
exits on line which should cause an exception but without
it!
When I place same code in my WinForm exceprion occures.
1. Is that exception caused or not?
2. Is Timer.Elapsed method run in different thread?
3. What to do to be informed of such exceptions in run-
time (program can be stopped but with normal info about
exception) - I was looking for long time what was the
reason for not executing some code after it.
Thank you 7 1110
Przemo,
I am curious, what is the reason you are using the C# code in your VBNet
project for conversion, while some of the the more advantage C# users would
like to have those powerfull VBNet convert methods?
Cor
Sorry, but did you help Przemo?
I can't understand you
best regards -----Original Message----- Przemo,
I am curious, what is the reason you are using the C#
code in your VBNetproject for conversion, while some of the the more
advantage C# users wouldlike to have those powerfull VBNet convert methods?
Cor
.
> Sorry, but did you help Przemo? I can't understand you
I thought this is a newsgroup, not a kind of helpdesk.
Now I can't understand you?
Cor
Thanks for replay, but I don't nderstad.
Am I using C# code?? I am using VB.NET.
This code compiles in vb.net project with no errors.
So what did you mean? -----Original Message----- Przemo,
I am curious, what is the reason you are using the C#
code in your VBNetproject for conversion, while some of the the more
advantage C# users wouldlike to have those powerfull VBNet convert methods?
Cor
.
Przemo, Thanks for replay, but I don't nderstad. Am I using C# code?? I am using VB.NET. This code compiles in vb.net project with no errors. So what did you mean?
In that are you right, however you limit yourself in my opinion to a very
small subset. When you would do by instance this,
For i = 1 to 1000
a +=5
Next
And than ask something as why is this not efficient to a newsgroup.
It is using as well VBNet code, however most people use
a = 5*1000
So I was curious why you are doing that?
Cor
My code was only example (small peace of my Comm parsing
Class).
I didn't want to know if it is efficient or not.
I couldn't understand why this line which should cause
exception do not do it in my class.
Write if you can help. -----Original Message----- Przemo, Thanks for replay, but I don't nderstad. Am I using C# code?? I am using VB.NET. This code compiles in vb.net project with no errors. So what did you mean? In that are you right, however you limit yourself in my
opinion to a verysmall subset. When you would do by instance this,
For i = 1 to 1000 a +=5 Next
And than ask something as why is this not efficient to a
newsgroup. It is using as well VBNet code, however most people use a = 5*1000
So I was curious why you are doing that?
Cor .
Przemo,
This throws an exception when I try this.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
' This line should throw an exception because of
' different culture setting (2.54 in spite of 2,54)
' but it doesn't, exits sub and Beep is not performed
Dim a As Double = Double.Parse("2.54", New
Globalization.CultureInfo("pl-PL"))
Beep()
End sub
I hope this helps?
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mag31 |
last post by:
Is there any way to find out if a particular .net function will throw an
exception without first generating the exception?
I am using structured exception handling i.e. try catch finally blocks...
|
by: Gianni Mariani |
last post by:
I'm involved in a new project and a new member on the team has voiced a
strong opinion that we should utilize exceptions.
The other members on the team indicate that they have either been burned...
|
by: Brian Folke Seaberg |
last post by:
I was recently browsing a couple of C++ books at the local bookstore.
One book called throwing exceptions from constructors a "dubious practice."
Another book recommended not throwing...
|
by: Pietje de kort |
last post by:
Hello all,
I want to implement Timeout behaviour in a class of mine. When a
method is called it should timeout after a few seconds. To do this
I've built a
System.Threading.Timer that calls a...
|
by: Drew |
last post by:
How do I know which exceptions are thrown by certain methods?
For example, reading a file might throw an IO Exception, etc.
In Java, the compiler won't even let you compile unless you put your...
|
by: Sam Miller |
last post by:
Normally the debugger (visual studio .net environment) is good at pointing
out the line of code that caused an exception.... except when that code is
executed as part of a timer handler. In the...
|
by: brunft |
last post by:
I was testing this with .NET Framework 2.0.
Exceptions in the Elapsed event handler of a System.Timers.Timer are
ignored, they are not handled by the runtime and not reported (when
running...
|
by: Jakub Moskal |
last post by:
Hi,
I want to write a benchmark that will measure performance of several
different algorithms for the same problem. There is a set time bound
though, the algorithm cannot run longer than n...
|
by: sip.address |
last post by:
Hello,
I'm trying to find some existing (and simple if possible) timer queue
implementation. Does anybody know a simple skeleton to use as example?
I just need to send simple (relative)...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |