登录后显示用户名: [英] Display users name once they have logged in:

查看:111
本文介绍了登录后显示用户名:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想知道,一旦用户登录到应用程序后如何显示用户名?

如果他们使用正确的用户名和密码登录,则在下一个表格中应显示其名称.

请让我知道我能做什么.

谢谢

Hi,
I would like to know, as to how i can diplay a users name once they have logged on to a application?

If they logged on with their username and password correctly, then on the next form their name should display.

Please let me know what i can do.

Thanks

推荐答案

首先创建一个类似于下面的用户类,
First create a user class something like below,
public class UserProfile
{
  public string UserName {get;set;};
  .........................
}



然后成功登录后,只需创建一个静态用户对象,如

静态UserProfile userProfile = new UserProfile();并分配用户名

userProfile.UserName ="XYZ";

那么您就可以在应用程序中以任何形式访问该对象(在您的情况下,在下一个表单中).

lblUsername.Text = UserProfile.UserName;



then on successful login,just create one static user object like ,

static UserProfile userProfile=new UserProfile(); and assign the username

userProfile.UserName="XYZ";

then you can access that object in any form in your application(in your case on next form).

lblUsername.Text=UserProfile.UserName;


在成功登录后将用户名存储在字符串中.然后获取用户名的相应名称或直接显示用户名.
Store the username in a string after successful login. Then fetch the corresponding name for the username or disply the username directly.


这是Windows应用程序,而不是Web应用程序.

成员资格控制?请怎么做一个例子.
就会话而言,我知道它是在asp.net中使用的,而不是在vb.net中使用的...
This is a Windows application , not web application.

Membership controls ? how does that work an example please.
As far as sessions goes, i know it''s used in asp.net stuff not in vb.net...


这篇关于登录后显示用户名:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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