Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating my own enhanced dos language Pin
Richard MacCutchan21-Jul-20 10:25
mveRichard MacCutchan21-Jul-20 10:25 
QuestionHelp with a program that's made in c# - I have the source Pin
Member 1489329719-Jul-20 2:32
Member 1489329719-Jul-20 2:32 
AnswerRe: Help with a program that's made in c# - I have the source Pin
Garth J Lancaster19-Jul-20 2:42
professionalGarth J Lancaster19-Jul-20 2:42 
AnswerRe: Help with a program that's made in c# - I have the source Pin
Richard MacCutchan19-Jul-20 3:47
mveRichard MacCutchan19-Jul-20 3:47 
QuestionHow to debug Web Service with remote debug? Pin
Member 767463417-Jul-20 3:31
Member 767463417-Jul-20 3:31 
AnswerRe: How to debug Web Service with remote debug? Pin
Dave Kreskowiak17-Jul-20 10:36
mveDave Kreskowiak17-Jul-20 10:36 
GeneralRe: How to debug Web Service with remote debug? Pin
Member 767463419-Jul-20 22:15
Member 767463419-Jul-20 22:15 
QuestionHandling a Leading Decimal in a TextBox Pin
Member 1487212816-Jul-20 9:48
Member 1487212816-Jul-20 9:48 
I am trying to figure out how to handle the situation where a decimal is inserted into a text box as the only character.

If I clear the textbox and begin inserting a value without starting with a 0, (Say I want 0.0086, but start to type .0086) I get the error:
System.FormatException: 'Input string was not in a correct format.'

as soon as the decimal is typed. I used something like:
if (tbAI0LineSlope.Text.Length == 0 & tbAI0Offset.Text.Length == 0)

to handle empty box, but not sure how to deal with the decimal issue.

float test1 = 1;
float test2 = 0;

if (tbAI0LineSlope.Text.Length == 0 & tbAI0Offset.Text.Length == 0)

{

    tbAI0Val.Text = (iData[7] * test1 + test2).ToString();
}

else if (tbAI0Offset.Text.Length == 0)
{

    tbAI0Val.Text = (iData[7] * float.Parse(tbAI0LineSlope.Text) + test2).ToString();
}

else if (tbAI0LineSlope.Text.Length == 0)
{

    tbAI0Val.Text = (iData[7] * test1 + int.Parse(tbAI0Offset.Text)).ToString();
}
else
{
    tbAI0Val.Text = (iData[7] * float.Parse(tbAI0LineSlope.Text) +
    int.Parse(tbAI0Offset.Text)).ToString();
}

AnswerRe: Handling a Leading Decimal in a TextBox Pin
OriginalGriff16-Jul-20 9:58
mveOriginalGriff16-Jul-20 9:58 
AnswerRe: Handling a Leading Decimal in a TextBox Pin
Richard MacCutchan16-Jul-20 21:32
mveRichard MacCutchan16-Jul-20 21:32 
GeneralRe: Handling a Leading Decimal in a TextBox Pin
Member 1487212817-Jul-20 2:52
Member 1487212817-Jul-20 2:52 
GeneralRe: Handling a Leading Decimal in a TextBox Pin
Richard MacCutchan17-Jul-20 3:07
mveRichard MacCutchan17-Jul-20 3:07 
QuestionHow to generate automatic test cases for any simple module Pin
sagarpallavi16-Jul-20 1:09
sagarpallavi16-Jul-20 1:09 
AnswerMy Downvote Pin
Keith Barrow16-Jul-20 3:58
professionalKeith Barrow16-Jul-20 3:58 
AnswerRe: How to generate automatic test cases for any simple module Pin
jkirkerx16-Jul-20 8:23
professionaljkirkerx16-Jul-20 8:23 
AnswerRe: How to generate automatic test cases for any simple module Pin
F-ES Sitecore17-Jul-20 1:15
professionalF-ES Sitecore17-Jul-20 1:15 
AnswerRe: How to generate automatic test cases for any simple module Pin
Gerry Schmitz17-Jul-20 4:27
mveGerry Schmitz17-Jul-20 4:27 
QuestionDoc version management Pin
cp-andy15-Jul-20 22:15
cp-andy15-Jul-20 22:15 
AnswerRe: Doc version management Pin
OriginalGriff15-Jul-20 22:22
mveOriginalGriff15-Jul-20 22:22 
GeneralRe: Doc version management Pin
#realJSOP15-Jul-20 23:44
professional#realJSOP15-Jul-20 23:44 
GeneralRe: Doc version management Pin
cp-andy16-Jul-20 1:35
cp-andy16-Jul-20 1:35 
GeneralRe: Doc version management Pin
OriginalGriff16-Jul-20 1:46
mveOriginalGriff16-Jul-20 1:46 
AnswerRe: Doc version management Pin
Pete O'Hanlon16-Jul-20 9:23
mvePete O'Hanlon16-Jul-20 9:23 
AnswerRe: Doc version management Pin
Gerry Schmitz17-Jul-20 4:36
mveGerry Schmitz17-Jul-20 4:36 
QuestionPadding a string with integers on its right keeping string length fixed Pin
simpledeveloper14-Jul-20 7:56
simpledeveloper14-Jul-20 7:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.