|
Use
checked
Like in example bellow:
try
{
z = checked(maxIntValue + 10);
}
catch (System.OverflowException e)
{
Console.WriteLine("CHECKED and CAUGHT: " + e.ToString());
}
checked on msdn
|
|
|
|
|
Where does the "e" comes from. What does "e" mean?
|
|
|
|
|
Look at type
catch (System.OverflowException e)
{ ...
e is my variable name it is short for exception. It is not obligatory to use any name if you wanna catch OverflowException without more information.
|
|
|
|
|
See here: checked (C# Reference)[^]
Or you can enable it for the whole app:
Go to project Properties and find the Build tab.
Click "Advanced" button.
In the resulting dialog, check the “Check for arithmetic overflow/underflow” box, and press OK.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Edit your question and provide better information.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Actually, it's not even a question. Just some words.
Regards,
Rob Philpott.
|
|
|
|
|
It's probably a question to him!
Trouble is he is so close to it (and likely English is not his first language) that he didn't consider that we need more than that. It's all he needs, because he knows what he is doing, and assumes there is only one way to do it, and we know what that is!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
|
|
A response exactly in proportion with the question
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
|
|
How to make windows form control DPI aware??
|
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Hi
I am doing one project using serialport. I have three forms in one form i receive command 'g' from serial port and display it to text box based on specify time interval. And in another form i want to receive command 'c' from serial port and display it to textbox and also wand to send data from textbox to serialport to update that value through one button click. And in last form i want to receive command 'v' from serialport and display it to textbox and send the data from textbox to serialport through button click. I have no idea to start this code... Please help me.... i am new in using serial port communication....
Thanks in advace
|
|
|
|
|
|
I am unable to get path of file that is in portable device.... please suggest me
|
|
|
|
|
Ask the user.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
Unless you want to search the entire file system of the device, and in the event of multiple files with the same names GUESS at which one is the correct path, you're going to have to ask the user.
|
|
|
|
|
Probably, you need to explain in much better detail what you are trying to do, and exactly what problem you have met.
Remember we can't see your screen, access your HDD, or read your mind, so we only get exactly what you tell us to work with.
Try again: explain what you have tried, and exactly what problem you are meeting - or we really can't help you with this one!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I have a problem about display control in datagridview using C#. my datagridview have 3 column(A(combobox), B(textbox), C(textbox, width= 50)) and is loaded data from database.
when the form is display, all cell of column C will be displayed as textbox(have border and the width = 30).
I researched but don't found solution. If you know about this, please help me.
Thank in advance.
|
|
|
|
|
WinForms? WPF? ASP.NET? Gtk#?
In case of WinForm, try adjusting the columns' width using the designer.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|