I've been looking for different ways to do it, but I still get the same error:
What I've tried:
float e = (float)Convert.ToDouble(e_textBox.Text);
bool valid = float.TryParse(e_textBox.Text.ToString(), out e);
And I get this error:
Error 1 Cannot implicitly convert type 'float' to 'System.EventArgs'
am I doing that wrong? Thank you.
I'm guessing your code lives inside an event handler. One of the parameters to your handle will be EventArgs e:
public void OnClick(object sender, EventArgs e)
{
float e = (float)Convert.ToDouble(e_textBox.Text);
bool valid = float.TryParse(e_textBox.Text.ToString(), out e);
}
You just need to come up with a new variable name (or rename the parameter to something other than e):
public void OnClick(object sender, EventArgs eargs)
{
float e = (float)Convert.ToDouble(e_textBox.Text);
bool valid = float.TryParse(e_textBox.Text.ToString(), out e);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With