iT邦幫忙

0

checkBox的問題

if (checkBox1.IsChecked == true)
System.Diagnostics.Process.Start(@"j:\abc");
if ((checkBox1.IsChecked == true) && (checkBox2.IsChecked == true))
System.Diagnostics.Process.Start(@"j:\def");

請問 如果是這樣設定 如何在選擇checkBox1 + checkBox2時不會彈出abc和def 兩個檔案 只是開def檔案
感謝

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

2
柯柯
iT邦新手 3 級 ‧ 2018-08-14 08:32:57
最佳解答
1.
if ((checkBox1.IsChecked == true) && (checkBox2.IsChecked == true)){
    System.Diagnostics.Process.Start(@"j:\def");
}else if(checkBox1.IsChecked == true){
    System.Diagnostics.Process.Start(@"j:\abc");
}
2.
if (checkBox1.IsChecked == true){
    if(checkBox2.IsChecked == true){
        System.Diagnostics.Process.Start(@"j:\def");
    }else{
        System.Diagnostics.Process.Start(@"j:\abc");
    }
}

第二不對吧

柯柯 iT邦新手 3 級 ‧ 2018-08-14 08:54:48 檢舉

對 第二有問題 謝謝提醒 已經刪掉了 哈哈/images/emoticon/emoticon06.gif

我要發表回答

立即登入回答