簡體   English   中英

如何在數據網格視圖表上顯示單選按鈕的值

[英]How to display values of radio button onto data grid view table

有 2 個單選按鈕:一個用於約會,一個用於任務。 我想知道如果選擇了另一個單選按鈕任務,我如何獲得它的值。 目前即使我選擇了任務的單選按鈕,它仍然會給我約會的價值。 有我可以使用的 Or 函數嗎? 只能選擇一個按鈕來選擇約會/任務。

int n = dataGridView1.Rows.Add();
dataGridView1.Rows[n].Cells[0].Value = radioAppointment.Text;
dataGridView1.Rows[n].Cells[1].Value = textLocation.Text;
dataGridView1.Rows[n].Cells[2].Value = dateTimePicker1.Text;
    int n = dataGridView1.Rows.Add();
    string val;
    if(radioAppointment.checked==true){
    val=radioAppointment.Text;
    }
if(radioTask.checked==true){
    val=radioTask.Text;
    }
    dataGridView1.Rows[n].Cells[0].Value = val;
    dataGridView1.Rows[n].Cells[1].Value = textLocation.Text;
    dataGridView1.Rows[n].Cells[2].Value = dateTimePicker1.Text;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM