登录时显示用户名 [英] Display user name when logged in

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

问题描述

登录时如何在标题中显示用户名.登录后,用户名及其ID可以显示项目中的所有其他表单.
我的前端是vb.net,后端是ms access.

How to display the username in the header when logged in. After logged in, The user name and its id can display all other form''s in a project.
My front end is vb.net and back end is ms access.

推荐答案

Windows或Web应用程序?我认为它是Windows应用程序.

登录后,将用户ID和用户名保存在静态变量或其他内容中.并在任何地方显示值.如果它是一个Web应用程序,则将详细信息存储在Session中并显示值.
Windows or web application? I think its windows application.

After login save the User id & User name in static variable or something. And display the value anywhere. If its a web application then store the details in Session & display the values.


是的.正如拉贾(Raja)所说.使用静态变量并将登录用户ID分配给变量,然后您就可以在项目中的任何位置访问它们.
静态变量的行为就像全局变量.您可以将 public 模块与用作全局变量的变量一起使用.

在VB.NET Windows应用程序中创建全局变量 [
Yes. as Raja said. use static variable and assign login userid to variable then you can access them everywhere in project.
static variable act''s like a global variable. you can use public module with variable used as Global.

Create global variable in VB.NET windows application[^]

and Take label on each form to assign this variable.


这很简单

这是样本

It is very simple

here is the sample

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Label1.Text = Form1.TextBox1.Text
   End Sub


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

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