哪个文本框事件? [英] which textbox event?

查看:85
本文介绍了哪个文本框事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在程序中编写了一个程序. admın表单有一个文本框和一个按钮,如果要打开程序,则输入密码,然后单击该按钮,您要输入密码,但是每次打开程序时,总是ı需输入密码.想要执行此程序,请记住我的密码,怎么办?文本框事件? ı想在文本框中保留我的密码

解决方案

您需要保留应用程序信息:
1)在解决方案资源管理器中,在项目窗口的属性下,双击"Settings.settings"
2)添加一个新设置.名称:userPassword,类型:字符串,范围:User
3)在您的表单Load事件中,添加:

Properties.Settings.Default.Reload();


4)然后添加:

tbPassword.Text = Properties.Settings.Default.userPassword;


5)最后,当您接受用户登录时:

Properties.Settings.Default.userPassword = tbPassword.Text;
Properties.Settings.Default.Save();


高级的东西是将密码保存为SHA哈希而不是纯文本-但这是为了在您更了解自己在做什么的时候...:laugh:


一个新控件,一个可以使用的复选框.如果选中,则记住密码(将其保存在客户端系统上进行安全加密左右).

下次,请检查是否存在给定用户名的密码,如果是,则通过代码将其加载到文本框中.


您将要在
textbox.text = [LOADED PASSWORD]

>事件.如果不确定如何执行此操作,请在设计器中双击标题栏,然后在打开表单时自动运行在其中输入的所有代码.


I wrıte a program ın wındows app. admın form has a textbox and a button you enter your password and clıck the button if you want to open program you wrıte your password but every open your program always ı must wrıte password .ı want to do thıs program remember my password how can ı do whıch textbox event? ı want to textbox hold my password

解决方案

You need to preserve application information:
1) In the solution explorer, under your project window, properties, double click on "Settings.settings"
2) Add a new setting. Name: userPassword, Type: string, Scope: User
3) In your form Load event, add:

Properties.Settings.Default.Reload();


4) Then add:

tbPassword.Text = Properties.Settings.Default.userPassword;


5) Finally, when you accept the user login:

Properties.Settings.Default.userPassword = tbPassword.Text;
Properties.Settings.Default.Save();


The advanced stuff is to save the password as an SHA hash rather than plain text - but that is for when you have more idea what you are doing... :laugh:


It would be a new control, a checkbox that can be used. If checked then remember the password (save it safely encrypted on client system or so).

Next time onwards, check if the password is present for the given username, if so load it in the textbox through code.


You''ll want to use

textbox.text = [LOADED PASSWORD]

in the

Form.Loaded

event. If you are unsure on how to do this, when you are in the designer, double click the titlebar, all code you enter in there will automatically be run when the form opens.


这篇关于哪个文本框事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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