レンタカー プログラムに追加しようとしています。質問ばかりですみません。私はまだ学んでいます:)。そのため、数値を入力しない場合やテキスト ボックスが空白の場合にポップアップするエラー メッセージをフォームに表示したいと考えています。私が試してみました:
//If nothing is inserted in text, error box.
int value = 0;
if (string.IsNullOrWhitespace(txtBegin.Text) || !int.TryParse(txtBegin.Text, out value)) // Test for null or empty string or string is not a number
MessageBox.Show("Please enter a number!");
else
MessageBox.Show(string.Format("You entered: {0}!", value));
エラーが表示されます:「string」には「IsNullOrWhitespace」の定義が含まれていません。誰でも私を助けることができますか?