如何在C#Windows应用程序中加载hompage
问题描述:
大家好,
我想在特定用户登录时显示主页,但是该首页包含该用户的所有信息,包括标签,图片框等控件,
请帮帮我.
在此先感谢.
Hi All,
I want display homepage when particular user log in but that hompage consist with all info of that user with label,picturebox,etc controls,
Please help me.
Thanks in Advance.
答
尝试此链接
以Windows窗体显示网页 [
try this link
Display a Web Page in a Windows Forms[^]
那家伙登录,因此您知道他是谁-您可以从存储信息的任何地方获取信息(希望是数据库).
所以显示它!哪一部分会导致您出现问题?
The guy just logged in, so you know who he is - you can get the information from wherever it was you stored it (hopefully a database).
So display it! What part of this is causing you problems?
您也可以这样做:
在Homeform中创建属性
像这样
you can do it like this too:
Create a Property in Homeform
Like this
private string userName;
public string UserName
{
get { return userName; }
set { userName = value; }
}
然后从loginForm
将Homeform的UserName属性设置为登录用户名
我的意思是这个
then From loginForm
set the UserName Property of Homeform to the username that who is logged in
I mean by this
if (.....)//Here You need to check the condition that the user is valid or not
{
FrmHome sd = new FrmHome();
sd.UserName = textBox1.Text;
sd.Show();
}
那么您将获得
登录到home的用户的用户名
如果您希望在标签中显示用户名,请使用此
then you will get the username of user who logged in to homefrom
If you wish to show the Username in a label Use this
private void FrmHome_Load(object sender, EventArgs e)
{
label1.Text = "Hai " + userName;
}
如果您以此得到答案...
单击顶部的接受解决方案"按钮...
If you got answer by this...
Click Accept Solution button on top...