首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

RadioButton1的CheckedChanged事件有关问题

2012-04-19 
RadioButton1的CheckedChanged事件问题在窗体中加入了以个radiobutton,也写了checkedchanged事件处理程序,

RadioButton1的CheckedChanged事件问题
在窗体中加入了以个radiobutton,也写了checkedchanged事件处理程序,代码如下:

VB.NET code
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged        Dim f2 As New Form2()        Me.Close()        f2.Show()    End Sub

目的是一单击radiobutton,就关掉此窗体,并调出form2窗体,可当单击后,程序显示正在运行,然后立马又终止了,中间什么反应也没看到,怎么回事呢?相关radiobutton的部分属性窗口如下:


另外我的环境是win7下的vs2008,vb.net语言

[解决办法]
Me.Close()改成 Me.Hide()即可。因为 Me.Close()就是关掉程序,自然接着就没东西了。
[解决办法]
C# code
            Thread th = new Thread(new ThreadStart( delegate {                this.Invoke(new MethodInvoker(delegate {                    this.Close();                }));                Form2 fm = new Form2();                Application.Run(fm);            }));            th.Start();
[解决办法]
先要有个主窗体,然后操作子窗体就没有这个问题了

热点排行