I'm using this code to ask a user for either yes or no, and I would like it to play a sound when the user selects no. But my code plays a sound if the user selects yes or no.
DialogResult dialogResult = MessageBox.Show("Buscar Informações do CEP Online?", "CEP Não Encontrado", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
//do something
// Process.Start("http://www.buscacep.correios.com.br/servicos/dnec/index.do");
Process.Start(
"http://www.buscacep.correios.com.br/servicos/dnec/consultaLogradouroAction.do?Metodo=listaLogradouro&CEP=" +
maskedTextBoxCep.Text + "&TipoConsulta=cep");
}
else if (dialogResult == DialogResult.No)
{
//do something else
SystemSounds.Exclamation.Play();
}
在某些计算机中,我有一个带有Process.Start的代码,该代码在运行该过程之前会发出惊叫声,我在5台不同的计算机上使用同一程序,并且只有1声蜂鸣,发出蜂鸣声的计算机与其他2台计算机具有相同的操作系统机器,我仍然不知道为什么,尝试将您的声音更改为另一种声音,以查看您听到的声音是否不是来自Process.Start。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.