をするためにコードを作るために何ができる私は、これらはそれだけで、これがすべてではないユーザーがiは
を望んで選択した項目が保存されます固定得ることができれば、私のボタンを救うに取り組ん4つのエラーとイムを持っています問題のあるコードだけをコード化してください。このプログラムは、2つのコンボボックスを使用してアプリケーションと3つのチェックボックス
私はエラーがあるIパットコメント行用とアイスクリームです
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
StreamWriter sw = new StreamWriter(
new FileStream(sfd.FileName,
FileMode.Create,
FileAccess.Write)
);
if(flavorBox) // i have an error right here (Cannot implicitly convert type 'System.Windows.Forms.ComboBox' to 'boolean)
{
sw.WriteLine(flavorBox.SelectedItem);
}
else(syrupBox) //syays i need semecolons right here for some reason
{
sw.WriteLine(syrupBox.SelectedItem);
}
if (Nuts.Checked)
{
this.Tag = "checked";
sw.WriteLine(Nuts);
}
else(Cherries.Checked) //says i need semicolons here to i dont know why
{
this.Tag = "checked";
sw.WriteLine(Cherries);
}
if(Sprinkles.Checked)
{
this.Tag = "checked";
sw.WriteLine(Sprinkles);
}
sw.Close();
}
}
ATこれは私の4TH ERRORで
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("Are you sure you want to send the data back?",
"Data Sender",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (result == DialogResult.No)
{
e.Cancel() = true; //ITS ASKED ME AM I MISSING A DIRECTIVE OR ASSEMBLY REFRENCE (FOR CANCEL)
}
「if(flavorBox)」はどういう意味ですか? –
私のcomboxの名前である –
のコンボボックスには名前がありません。それはあなたの変数の名前かもしれません。とにかくこの条件で何を確認したいですか? –