473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Login Form w/ Schedule, creating a form that displays a dynamic name

2
Hi all,

I have created a login form where both a manager and employee can login by entering their usernames and passwords. Once the employee logs in, I would like the next form (the schedule) to appear with the employees name at the top. I want the name at the top of the schedule form to be dynamic and change every time a new user logs in.

Thanks!
Nov 15 '17 #1
4 2273
Frinavale
9,735 Expert Mod 8TB
Sounds nice,

Have you created a custom Principal for this purpose? (Here's a link to documentation for the Principal Class)

You should be able to access the name through the Principal and display it on the screen.
Nov 15 '17 #2
adawg
2
Thanks for the reply. All I have is a login class that has usernames and passwords for various employees. I just want the name of the person who logs in to be input into the top of the schedule form that pops up once they login. How would I use a Principal class for this?
Nov 15 '17 #3
Luk3r
300 256MB
This may be a silly answer, but couldn't this be accomplished with a Form_Load event OR by passing the name from your original Form? I'm not sure if it's the Form's title(text) that you're wanting to change or if it's some sort of label on the second form, but this should be fairly simple. Please note that Environment.GetEnvironmentVariable() can be substituted with a value from a textbox or inputbox. For example:

Form Open Example:
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Form2.Text = "Form2 - " & Environment.GetEnvironmentVariable("username")
  3.         Form2.ShowDialog()
  4.     End Sub
Form Load Event:
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Me.Text = "Form2 - " & Environment.GetEnvironmentVariable("username")
  3.     End Sub
Nov 16 '17 #4
Frinavale
9,735 Expert Mod 8TB
Luk3r's suggestion sounds like it might work for your very simple case.

I implement custom Identity and Principal classes (they implement the IIDentity and IPrincipal interfaces) and use them to authenticate the user (checking the user name and password on logging in) and to be able to enforce customized permissions based on the Roles defined in the Principal object.

It may be overly complicated for your situation though.

When I was in college, my first "login" project was simply to authenticate a user by checking user name and password against a database or flat text file (THIS WAS NOT SECURE). Once the user "logged in" I just stored their user name in Session (for web applications) and went from there.

Now I do things much more securely and the custom principals make it really easy to check if the user is in roles when accessing restricted areas of my applications (whether that be web applications or desktop applications).

While your needs may be satisfied by Luk3r's suggestion, it never hurts to be aware of Principals and Identities

-Frinny
Nov 16 '17 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John Wolrehammer | last post by:
After the user login in i want to close the login form. I can close it but it also closes the whole application. Can anyone help.
2
by: skubik | last post by:
I'm curious as to whether it's possible to create a Form object and populate it with form element objects, strictly in Javascript, without the need to apply the form to a document. Essentially,...
5
by: JPSutor | last post by:
I have a login form, that if successfully answered, launches another form. The problem is that the login form remains even after I show the main form. How do I get rid of the login form?
3
by: Bob | last post by:
I haver a user login form (winforms app using vs2005 in VB.NET). After succesfull validayion of user I want to open a first form and close the loging form that was used, If I write If...
5
by: Ronald S. Cook | last post by:
It's been longer that I remember since writing windows (not web) apps. 1) I want to load a main form 2) User clicks login button which brings up login form (on top of main form) 3) Upon...
0
by: LLM | last post by:
Is this not possible? I had my app all running nice, then I addd a login form that comes up first NOT inside the MDI, just by itself. Then I had the login form open the MDI form and the MDI opens...
19
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash...
3
by: scripteaze | last post by:
posting to a form with no form name or it's just that i cant find the form name. can anyone explain how to either post to a form with no name or, find the name of the form..here my current output,...
1
Jacotheron
by: Jacotheron | last post by:
Hi all I have a problem. I need to create a script that takes user input from a form (Username, Password, Domain) and with these input go to the page that contains their website statistics. I...
1
by: RLN | last post by:
RE: Access 2003 After the user puts in the password to log in, (in frmLogin, I am displaying the main data entry form. That all works great, but now I cannot close the Login form (behind the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.