I made a Regex
which filters for double
values.
For example one TextBox
contains volume and I use this regex
for
double ConvertToDouble(String input)
{
// Matches the first numebr with or without leading minus.
Match match = Regex.Match(input, "[+-]?\\d*\\.?\\d+");
if (match.Success)
{
return Double.Parse(match.Value);
}
return 0; // Or any other default value.
}
Somehow this returns 0
when I enter 0,5
into the TextBox
.