我的 WinForm 中有一个文本框,当我输入密码时,它是隐藏的,因为:
private void textBoxPWMain2_TextChanged(object sender, EventArgs e)
{
textBoxPWMain2.UseSystemPasswordChar = true;
}
Run Code Online (Sandbox Code Playgroud)
是否可以在这里添加一个按钮,当按下按钮时,密码显示正常,当我停止按下按钮时,密码会再次隐藏?
我实际上正在编写一个程序,使用Microsoft.Office.Interop.Excel创建我需要的特定excel文件.这很好用.
我的程序创建,然后保险箱并关闭新的Excel文件(工作正常).
sheet.SaveCopyAs(path);
sheet.Saved = true;
sheet.Close(true, misValue, misValue);
excel.Quit();
Run Code Online (Sandbox Code Playgroud)
成功创建新的Excel文件后,将打开DialogResult框并询问是否要打开新的Excel文件
DialogResult dr = MessageBox.Show("Open new file?", "text", MessageBoxButtons.YesNo);
{
if (DialogResult == DialogResult.Yes)
{
Process.Start(path);
}
else if (DialogResult == DialogResult.No)
{
this.Close();
}
Run Code Online (Sandbox Code Playgroud)
但是当我按YES时,没有任何反应,新文件无法打开.
我在表单上添加了一个额外的按钮
private void button4_Click(object sender, EventArgs e)
{
Process.Start(path);
}
Run Code Online (Sandbox Code Playgroud)
这种方式有效,但为什么DialogResult Box不能打开我的新Excel文件?