MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show("Are there any other products in the carton?", "Question", buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result == DialogResult.Yes)
{
trans.Rollback();
MessageBox.Show("Please go to the controll room for new packaging", "Message");
frmHome main = new frmHome(empid);
main.Show();
this.Hide();
}
if (result == DialogResult.No)
{
trans.Commit();
frmPalletCartonAllocation pca = new frmPalletCartonAllocation(pack, companyIdNo, skuIdNo, UnitsInCarton, UnitsInPack, carton_Code, orderNo, grvIdNo, empid);
pca.Show();
this.Hide();
}
Run Code Online (Sandbox Code Playgroud)
在出现消息框时,"是"按钮会突出显示.我希望"否"按钮突出显示.所以默认'不'.
我该怎么做呢?
Mik*_*oud 21
改变这个
MessageBoxDefaultButton.Button1);
Run Code Online (Sandbox Code Playgroud)
对此
MessageBoxDefaultButton.Button2);
Run Code Online (Sandbox Code Playgroud)
Moh*_*zen 15
将消息框更改为:
DialogResult result = MessageBox.Show(
"Are there any other products in the carton?",
"Question",
buttons,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10852 次 |
| 最近记录: |