473,486 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Alternative to try / catch?

I want to convert a string to a DateTime type. The user can enter the date in
various formats and I am not sure if it will be a valid Date. Is it possible
to check if a string can be converted to a DateTime type without using a try
/ catch block. I was thinking of maybe something like is or as commands. But
both do not seem to work for this. Any suggestions will be much appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.
Jul 4 '06 #1
11 4616
Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course, you
want to parse the format yourself. However, I think that the try/catch is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microsof t.com...
>I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.

Jul 4 '06 #2
Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime are
in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course, you
want to parse the format yourself. However, I think that the try/catch is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microsof t.com...
I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.


Jul 4 '06 #3
If try/catch is slowing you down, you are probably running your code
through the debugger (pressing F5 for example).

Here's a good read about exceptions and performance:

http://www.yoda.arachsys.com/csharp/exceptions.html


On Tue, 4 Jul 2006 01:29:01 -0700, Tantr Mantr
<Ta********@discussions.microsoft.comwrote:
>Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime are
in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course, you
want to parse the format yourself. However, I think that the try/catch is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microso ft.com...
>I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.


Jul 4 '06 #4
Tantr,

You could use a Regex, but I have to say, I really think that you
should stick with the try/catch, as it's the difference between maintaining
a few lines of code, versus a lot more.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime
are
in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course,
you
want to parse the format yourself. However, I think that the try/catch
is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microso ft.com...
>I want to convert a string to a DateTime type. The user can enter the
date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using
a
try
/ catch block. I was thinking of maybe something like is or as
commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be
something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net
ver
1.1

Thanks in advance.



Jul 4 '06 #5
Tantr Mantr wrote:
Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime are
in a Column of a grid , so called multiple times.
Just how many elements are in this grid? In release mode, exceptions
are incredibly quick, despite the misinformation to the contrary.
Unless you've got thousands and thousands of invalid dates, it's
unlikely to be causing a significant loss in performance except in the
debugger.

See http://www.pobox.com/~skeet/csharp/exceptions.html for more on
this.

Jon

Jul 4 '06 #6
I am surprised that noone has mentioned the DateTime.TryParse method
http://msdn2.microsoft.com/en-us/library/ch92fbc1.aspx.

This method is new in 2.0 (so is not really applicable to you) but does
exactly what you are asking for, if/when you move it is a better option for
you to use :)

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microsof t.com...
>I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.

Jul 4 '06 #7
Nicholas mentioned it in the first reply...

Greg Young wrote:
I am surprised that noone has mentioned the DateTime.TryParse method
http://msdn2.microsoft.com/en-us/library/ch92fbc1.aspx.

This method is new in 2.0 (so is not really applicable to you) but does
exactly what you are asking for, if/when you move it is a better option for
you to use :)

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microsof t.com...
>I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.

Jul 4 '06 #8
A regular expression can't catch every illegal date, but it can very
well be used to verify that it at least looks like a date. You can
verify that the month is in the range one to twelve, and that the day is
in the range one to 31.

You can use the regular expression to get the year, month and day from
the string. Use the Calendar.GetDaysInMonth method to get the number of
days in that month and compare it to the day value that you have. This
way you can validate the date without using exceptions.

I checked this code for speed:

GregorianCalendar calendar = new GregorianCalendar();
Regex verify = new
Regex(@"^(0[1-9]|[1-2]\d|3[0-1])/(0[1-9]|1[0-2])/(\d\d\d\d)$",
RegexOptions.Compiled);
for (int i = 0; i < 1000000; i++) {
string date = "14/12/2006";
Match match = verify.Match(date);
if (match.Groups.Count == 4) {
int year = int.Parse(match.Groups[3].Value);
int month = int.Parse(match.Groups[2].Value);
int day = int.Parse(match.Groups[1].Value);
if (day <= calendar.GetDaysInMonth(year, month)) {
DateTime theDate = new DateTime(year, month, day);
}
}
}

It parses a million dates in three seconds, and discards a million
incorrectly formatted dates in half a second.

The I compared it to this code:

for (int i = 0; i < 1000000; i++) {
string date = "12/13/2006";
try {
DateTime theDate = DateTime.ParseExact(date, "dd/MM/yyyy",
CultureInfo.InvariantCulture);
} catch (Exception ex) {
}
}

It parses a million dates in just one second, but a million incorrect
dates takes 60 seconds to handle.
Tantr Mantr wrote:
Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime are
in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course, you
want to parse the format yourself. However, I think that the try/catch is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microso ft.com...
>>I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.

Jul 4 '06 #9
This is why the TryParse pattern is used in 2.0.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Göran Andersson" <gu***@guffa.comwrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
>A regular expression can't catch every illegal date, but it can very well
be used to verify that it at least looks like a date. You can verify that
the month is in the range one to twelve, and that the day is in the range
one to 31.

You can use the regular expression to get the year, month and day from the
string. Use the Calendar.GetDaysInMonth method to get the number of days
in that month and compare it to the day value that you have. This way you
can validate the date without using exceptions.

I checked this code for speed:

GregorianCalendar calendar = new GregorianCalendar();
Regex verify = new
Regex(@"^(0[1-9]|[1-2]\d|3[0-1])/(0[1-9]|1[0-2])/(\d\d\d\d)$",
RegexOptions.Compiled);
for (int i = 0; i < 1000000; i++) {
string date = "14/12/2006";
Match match = verify.Match(date);
if (match.Groups.Count == 4) {
int year = int.Parse(match.Groups[3].Value);
int month = int.Parse(match.Groups[2].Value);
int day = int.Parse(match.Groups[1].Value);
if (day <= calendar.GetDaysInMonth(year, month)) {
DateTime theDate = new DateTime(year, month, day);
}
}
}

It parses a million dates in three seconds, and discards a million
incorrectly formatted dates in half a second.

The I compared it to this code:

for (int i = 0; i < 1000000; i++) {
string date = "12/13/2006";
try {
DateTime theDate = DateTime.ParseExact(date, "dd/MM/yyyy",
CultureInfo.InvariantCulture);
} catch (Exception ex) {
}
}

It parses a million dates in just one second, but a million incorrect
dates takes 60 seconds to handle.
Tantr Mantr wrote:
>Many Thanks Nicholas! How do I parse the Format myself? Should I be
looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime
are in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
>>Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course,
you want to parse the format yourself. However, I think that the
try/catch is better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@micros oft.com...
I want to convert a string to a DateTime type. The user can enter the
date in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using
a try
/ catch block. I was thinking of maybe something like is or as
commands. But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be
something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net
ver
1.1

Thanks in advance.


Jul 4 '06 #10
On my dated server, it took 2.08 seconds to parse a million dates and
discarded a million in 68.03 seconds.

I tried .net 2.0's TryParse() for comparison. It parsed a million
dates in 2.09 seconds and discarded a million in 2.63 seconds!!

On Wed, 05 Jul 2006 01:13:15 +0200, Göran Andersson <gu***@guffa.com>
wrote:
>A regular expression can't catch every illegal date, but it can very
well be used to verify that it at least looks like a date. You can
verify that the month is in the range one to twelve, and that the day is
in the range one to 31.

You can use the regular expression to get the year, month and day from
the string. Use the Calendar.GetDaysInMonth method to get the number of
days in that month and compare it to the day value that you have. This
way you can validate the date without using exceptions.

I checked this code for speed:

GregorianCalendar calendar = new GregorianCalendar();
Regex verify = new
Regex(@"^(0[1-9]|[1-2]\d|3[0-1])/(0[1-9]|1[0-2])/(\d\d\d\d)$",
RegexOptions.Compiled);
for (int i = 0; i < 1000000; i++) {
string date = "14/12/2006";
Match match = verify.Match(date);
if (match.Groups.Count == 4) {
int year = int.Parse(match.Groups[3].Value);
int month = int.Parse(match.Groups[2].Value);
int day = int.Parse(match.Groups[1].Value);
if (day <= calendar.GetDaysInMonth(year, month)) {
DateTime theDate = new DateTime(year, month, day);
}
}
}

It parses a million dates in three seconds, and discards a million
incorrectly formatted dates in half a second.

The I compared it to this code:

for (int i = 0; i < 1000000; i++) {
string date = "12/13/2006";
try {
DateTime theDate = DateTime.ParseExact(date, "dd/MM/yyyy",
CultureInfo.InvariantCulture);
} catch (Exception ex) {
}
}

It parses a million dates in just one second, but a million incorrect
dates takes 60 seconds to handle.
Tantr Mantr wrote:
>Many Thanks Nicholas!
How do I parse the Format myself? Should I be looking at Regex?
Its just that the Try/catch is making the app quite slow as the DateTime are
in a Column of a grid , so called multiple times.

Cheers!

"Nicholas Paldino [.NET/C# MVP]" wrote:
>>Tantr,

Other than using a Try/Catch, there isn't a way. Unless of course, you
want to parse the format yourself. However, I think that the try/catch is
better in terms of maintainability.

When you move to .NET 2.0, you can use the TryParse method on the
DateTime structure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@micros oft.com...
I want to convert a string to a DateTime type. The user can enter the date
in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.

Jul 5 '06 #11
missed it.
"Göran Andersson" <gu***@guffa.comwrote in message
news:uG**************@TK2MSFTNGP05.phx.gbl...
Nicholas mentioned it in the first reply...

Greg Young wrote:
>I am surprised that noone has mentioned the DateTime.TryParse method
http://msdn2.microsoft.com/en-us/library/ch92fbc1.aspx.

This method is new in 2.0 (so is not really applicable to you) but does
exactly what you are asking for, if/when you move it is a better option
for you to use :)

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
"Tantr Mantr" <Ta********@discussions.microsoft.comwrote in message
news:EF**********************************@microso ft.com...
>>I want to convert a string to a DateTime type. The user can enter the
date in
various formats and I am not sure if it will be a valid Date. Is it
possible
to check if a string can be converted to a DateTime type without using a
try
/ catch block. I was thinking of maybe something like is or as commands.
But
both do not seem to work for this. Any suggestions will be much
appreciated.

Right now i have :
string s = "01/05/2006"; //user will be entering the data ,
//this could be something
invalid like 22/22/2006
try
{
DateTime dt = DateTime.Parse(s);
MessageBox.Show("Date Parse Ok!");
//..other processing
}
catch(FormatException formatEx)
{
MessageBox.Show(formatEx.Message);
}
I was thinking of something along the lines :

if(s is DateTime)
MessageBox.Show("Date !!!");
else
MessageBox.Show("String...");

but this does not work as C# always considers s to be of type string.
Is there any way of not using the try / catch block? I am using .Net ver
1.1

Thanks in advance.
Jul 5 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
2318
by: Steven T. Hatton | last post by:
If I understand correctly, I have no assurance that I can determine the type of a simple class instance thrown as an exception unless I explicitly catch it by name. (non-derived classes having no...
3
3357
by: valued customer | last post by:
Is there a more concise way to do something like the the desired code below? The gripe is with the try-catch syntax. It takes *way* too many lines of code to evaluate a conditional expression...
11
6862
by: kaeli | last post by:
Hey all, I'd like to start using the try/catch construct in some scripts. Older browsers don't support this. What's the best way to test for support for this construct so it doesn't kill...
20
1335
by: Woody Splawn | last post by:
In a message yesterday titled Try Catch Question I got numerous responses. Thank you to all. After all the smoke clears I guess the question is where to place the Return True statement in the...
32
6081
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I...
15
11736
by: Neo | last post by:
Hello All, Although, I have read all the advantages of using Try Catch Block instead of "On error goto", I am still confused what is alternative for classic "Resume" statement. "Resume" was one...
1
2787
by: yancheng.cheok | last post by:
Hi all, According to "How can I handle a constructor that fails?" in http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.2, whenever there is a constructor fail, we will throw...
5
3811
by: Bry | last post by:
I've created a class that offers an enhanced way of handling fatal exceptions. The class allows the user to optionaly submit a http based anonymous error report to myself, and also records details...
3
2249
by: =?Utf-8?B?SmVycnk=?= | last post by:
Hi All, I want to fill some textbox with properties from Active Directory. The fact is if the property is unavailable the program will crash. You can prevent this by using a try and catch. So...
0
6964
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...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5427
agi2029
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,...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.