私はコンソールで完全に機能するdecimal
toに取り組んでいますが、コアの数学演算について次のエラーが発生します。binary converter
System.Windows.Forms.Button
の定義が含まれておらず、型の最初の引数を受け入れるToInt32
拡張メソッドが見つかりませんでした(usingディレクティブまたはアセンブリ参照がありませんか?)行:93ToInt32
System.Windows.Forms.Button
メソッド'ToString'のオーバーロードは2つの引数を取りませんLine:94
System.Windows.Forms.Buttonには、「ToInt32」の定義が含まれておらず、「System.Windows.Forms.Button」タイプの最初の引数を受け入れる拡張メソッド「ToInt32」が見つかりませんでした(usingディレクティブまたはアセンブリリファレンス?)行:103
コードは次のとおりです。
public void Convert_Click(object sender, EventArgs e)
{
string Input;
bool IsNotBinary;
string Answer;
Start:
Input = UserInput.Text;
int InputLength = Input.Length;
if (InputLength > 10)
{
UserInput.Text = "Overflow";
goto Start;
}
int Int;
bool IsANumber = int.TryParse(Input, out Int);
if (IsANumber == false)
{
UserInput.Text = "Invalid Character";
goto Start;
}
IsNotBinary = Input.Contains("3");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("4");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("5");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("6");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("7");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("8");
if (IsNotBinary == true)
{
goto End;
}
IsNotBinary = Input.Contains("9");
End:
if (IsNotBinary == true)
{
// decimal to binary
int InputInt = Convert.ToInt32(Input); // converts the string "Input" to the int "InputInt"
Answer = Convert.ToString(InputInt, 2);
UserInput.Text = Answer;
}
else
{
// binary to decimal
Answer = Convert.ToInt32(Input, 2).ToString();
UserInput.Text = Answer;
}
Console.ReadLine();
goto Start;
}
public void QuitButton_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}