在检查辅助功能并运行表单后如何关闭用户控件 [英] how to close user control after check accessibility and run a form

查看:86
本文介绍了在检查辅助功能并运行表单后如何关闭用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一个用户控件,用于检查输入用户进行编程的可访问性. 如果id和pass错误,则什么都没有发生.
如果用户输入正确的ID和密码,则主窗体将显示bt show对话框:

hello all
i have a user control to check accessibility for entering users to program.
if id and pass is wrong,nothing happend.
if user enter the correct id and password,the main form will show bt show dialog:

form1 frm=new form1();
frm.showDialog();


但是用户控件仍然处于打开状态.加载主窗体后如何关闭它?

关于


but user control still is open.how to close that after loading main form?

Regards

推荐答案

这是一种解决方法:
http://stackoverflow.com/questions/4759334/how-can-i-close-a-login-form-and-show-the-main-form-without-my-application-closi [
here is one way of doing it :
http://stackoverflow.com/questions/4759334/how-can-i-close-a-login-form-and-show-the-main-form-without-my-application-closi[^]


尝试停止线程约2秒钟,然后关闭>>表单. (使用此代码):
try stop the thread about 2 second and then close the form >> (use this code) :
System.Threading.Thread.Sleep(2000);
this.Close();




您说您有userControl,我认为此userControl用于登录功能.您必须已在一个Windows窗体中添加了此userControl.您不应该在userControl中调用close方法.相反,您需要以包含userControl的形式编写关闭函数.

您需要创建一个 delegate ,当成功执行userControl登录后,该委托将调用Form的close方法.

希望你有主意,
谢谢
-Amit Gajjar
Hi,

You said that you have userControl and i think this userControl is for Login functionality. You must have added this userControl in one of your Windows Form. You should not call close method inside userControl. instead you need to write closing function in your form that containing userControl.

You need to create one delegate and that delegate will call the close method of your Form when you succeeded with userControl login.

Hope you got idea,
Thanks
-Amit Gajjar


这篇关于在检查辅助功能并运行表单后如何关闭用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆