将登录用户详细信息从登录表单传递到VB.Net中的任何表单 [英] Passing Login User Details from Login Form to Any Form in VB.Net
本文介绍了将登录用户详细信息从登录表单传递到VB.Net中的任何表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在登录表单中,我将用户名从usernametextbox.text保存到username变量.
我希望此用户名变量可以在完整应用程序中的任何形式上访问.
例如,如果我想在表单上显示登录用户的详细信息,而我想默认为user1将数据保存到表单中,该怎么做?
Hello All,
In Login Form, I am saving username from usernametextbox.text to username variable.
I want this username variable to be accessible on any forms in the complete application.
For example, If i want to show the login user details on a form where I want to default that user1 has saved the data into the form, How do I do that?
推荐答案
亲爱的朋友U可以为此目的将用户信息保存在任何静态/共享变量中
公共NotInheritable类class1
私人子New()
结束子
公用共享的用户名As String
结束类
Dear friend U can save the user information in any static/shared variable for this purpose like this
Public NotInheritable Class class1
Private Sub New()
End Sub
Public Shared username As String
End Class
这篇关于将登录用户详细信息从登录表单传递到VB.Net中的任何表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文