簡體   English   中英

使用C#中的RadioButton轉到其他形式

[英]Go to Other Forms with RadioButton in C#

在c#windowsForm應用程序中,我有3個窗體,在第一個窗體中,我有2個RadioButtons。 如果要選擇RadioButton1,我要轉到Form2,如果要選擇RadioButtn2,我要轉到Form3。

我怎樣才能做到這一點?!

只需使用單選按鈕的CheckedChanged事件來檢測選擇了哪個單選並啟動表單

   private void radioButton_CheckedChanged(object sender, EventArgs e)
    {
        if (radioButton1.Checked)
            new Form1().Show();
        else
            new Form2().Show();
    }

暫無
暫無

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

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