如何返回我用来登录表单的用户名? [英] How to return username which I uset to login into form?

查看:108
本文介绍了如何返回我用来登录表单的用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


大家好我真的有问题。我真的需要这个命令就是这个问题:



在表单1中我创建了登录表单,当登录完成后表单3显示,我有一些文本框我也想写下数据库,但我想写这样做的用户的用户名(在这种情况下是电子邮件)。不是Windows名称,不是我的电脑名称。用于登录表单1(称为1)的电子邮件,用于存储在texbox中输入的其他数据。尝试用方法指出它,但我不能从形式1到形式2调用方法。即时使用2017视觉工作室c#形式

提前Thx



我尝试过:



WindowsIdentity.GetCurrent()。名称

Enviroment.Name

Hello everyone i really have a issue here. I really need this command here is the issue:

In form 1 i created login form, when login is completed form 3 shows up, there i have some text boxes which i want to write down to database also, but i want to write also user name (email in this case) of user who did this. Not windows name, not name of my computer. Email that i used to log in in form 1 (called 1), to store with these other data which is entered in texboxes. Tried to point it with method but i cant call method from form 1 to form 2. im using 2017 visual studio c# form
Thx in advance

What I have tried:

WindowsIdentity.GetCurrent().Name
Enviroment.Name

推荐答案

也许最简单的方法是使用静态类创建另一个项目,例如人。

Maybe the easiest way is to create another project with a static class, e.g. "Person".
public static class Person
{
    public static string FirstName;
    public static string LastName;
    public static string Email;
}

然后,您可以轻松地从表格中查询人员字段或属性。



如果你不喜欢我想使用额外的项目,你也可以使用默认的程序类(调用你的表格)来放置你需要的字段或属性。

You can then easily refer to Person fields or properties from your forms.

If you don't want to use an extra project, you can also use the default Program class (where your Forms are called) to place the fields or properties you need.


这篇关于如何返回我用来登录表单的用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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