基于C#代码窗口的应用程序

编程入门 行业动态 更新时间:2024-10-19 06:16:07
本文介绍了基于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#代码窗口的应用程序

本文发布于:2023-11-11 07:24:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577761.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   窗口   代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!