Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have a login screen where the user will input their First and Last Name. I would like the first and last name to appear at the top of each screen. Can someone help?

[EDIT]

Here is my code...could you tell me how I can display the username from "loginForm" into this form?

VB
Imports System.ComponentModel


Public Class escalationForm


    Private Sub escalationForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        My.Computer.Audio.Play(My.Resources.Adan, AudioPlayMode.Background)
        'Automatically plays audio file

    End Sub

    Private timer1 As New Timer

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        timer1.Interval = 34000
        timer1.Enabled = True
        AddHandler timer1.Tick, AddressOf Timer1_Tick

    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim f2 As New introTask2
        PrintForm1.Print()
        f2.Show()
        timer1.Enabled = False
        Close()
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        'Displays the First Name, Last Name, Date and Time
        Label9.Text = "Time: " + TimeString
        Label10.Text = "Date: " + DateString
        Label12.Text = "First Name: " + loginForm.TextBox1.Text
        Label11.Text(-"Last Name: " + loginForm)

    End Sub

End Class
Posted
Updated 19-May-11 8:02am
v2
Comments
Sergey Alexandrovich Kryukov 19-May-11 14:00pm    
Tag it! What is the language, platform, UI library?!
--SA
Sergey Alexandrovich Kryukov 20-May-11 12:56pm    
Please don't post your code as solution, if it is not a solution. Use "Improve question", "Add Comment" or reply to other comment.
--SA

Save it in the Session; set it in the page load.

How to do it will differ slightly depending on your web site coding method, but Google for "using Session variable" with your chosen language should find it ok.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-May-11 14:01pm    
What session? OP writes the code in Windows.Form, it looks like. This is OP's fault of course.
--SA
OriginalGriff 19-May-11 14:30pm    
It said Page when I answered! :laugh:
Sergey Alexandrovich Kryukov 19-May-11 14:09pm    
I added my recommendation for Forms, please see.
--SA
This is the most robust solution for inter-form collaboration: implementing appropriate interface by the form class.

Please see my past answer:
How to copy all the items between listboxes in two forms[^].

Some notes: you suffer from such a dirty code. The names like "label1", "label2" violate (good) Microsoft naming conventions. You should never leave Designer-generated names, rename them to some semantic names. Using times in most cases is quite a bad idea. Prefer thread to stay out of trouble. (See, for example, my past answer here: Timer Threading in C#[^].)

—SA
 
Share this answer
 
After login Save username in variable and use this variable in every form where you want to display name.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900