基于C#代码窗口的应用程序 [英] C# code windows based application

查看:84
本文介绍了基于C#代码窗口的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按Enter键时,登录页面的C#代码是什么.

what is the c# code for login page when i press enter key.

推荐答案

分三个步骤:
-登录表单应为模式表单(即与ShowDialog一起显示)
-它应该有一个OK/Login/etc按钮,其DialogResult设置为OK(导致窗体被关闭,并且控件在按下按钮时返回到导致ShowDialog的代码)
-表单应将其AcceptButton属性设置为该按钮(导致在按下Enter键时按下"按钮)
There are three steps:
- the login form should be modal (i.e. shown with ShowDialog)
- it should have an OK/Login/etc button with its DialogResult set to OK (causes the form to be closed and control to return to the code that caused ShowDialog when the button is pressed)
- the form should have its AcceptButton property set to that button (causes the button to be ''pressed'' when Enter is pressed)




您需要为其设置一个表单属性.

Hi,

You need to set a Form Property for it.

Form1.AcceptButton=btnLogin;



希望它对您有用.

问候
AR



Hope it will work for you.

Regards
AR


您必须将以下代码设置为txtname.KeyUp和txtPassword.KeyUp
命令

You have to set the below code to txtname.KeyUp And to txtPassword.KeyUp
command

if (e.KeyCode=13)
{
     Call LoginEvent();
}



您可以将登录代码设置为LoginEvent()

谢谢.



You can set your Login code to LoginEvent()

Thanks.


这篇关于基于C#代码窗口的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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