Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 177157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:00:16+00:00 2026-05-11T14:00:16+00:00

i have a LoginWindow with username and password to access in the software after

  • 0

i have a LoginWindow with username and password to access in the software after that the user authenticated i want show in the next window(the mainWindow of the software) the name of the user authenticated in a TextBlock …i show a code snippet of my LoginWindow:

public partial class Window1 : Window {     public Window1()     {         InitializeComponent();     }      public bool ValidateApplicationUser(string userName, string password)     {       {             var AuthContext = new DataClasses1DataContext();             var query = from c in  AuthContext.Users                         where (c.Username == userName.ToLower() && c.Password == password.ToLower())                         select c;              if(query.Count() != 0 )             {                 return true;             }              return false;         }     }      private void mahhh(object sender, RoutedEventArgs e)     {         bool authenticated = true;         {             if (usernameTextBox.Text !='' && passwordTextBox.Text != '')             {                 authenticated = ValidateApplicationUser(usernameTextBox.Text , passwordTextBox.Text);             }         }         if (!authenticated)         {             MessageBox.Show('Invalid login. Try again.');         }         else         {             MessageBox.Show('Congradulations! You're a valid user!');             MainWindow c = new MainWindow();             c.ShowDialog();         }     } } 

If I authenticate with the username’Marc’ in the MainWindow i will show the username ‘Marc’ in a TextBlock and I don’t know I make it? How I can do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:00:17+00:00Added an answer on May 11, 2026 at 2:00 pm

    Simply, Pass the UserName to the constructor of the Main window like this

    MainWindow c = New MainWindow(usernameTextBox.Text); 

    And in the constructor of the main window receive the value in variable and do whatever you want with it, like this

    private String _userName;  public MainWindow(string userName) {      _userName = userName } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever we deploy our sharepoint website we have pages that show a login-window to
I have a mainwindow, and another window called Loginwindow. In some point this LoginWindow
i have a login-window with two gtk.Entry objects, one for username, one for password.
I have a tabbar app and I want to add login window that will
I have Silverlight application i want to show login window before main page InitializeComponent();
i have a WPF Application with a LoginWindow to access,so i create a Splash
I have this method that generates random questions, I want to be able to
Basically I have a Login window which should close once the user logs in
I'm trying to implement a login window, in WPF. I have a MainWindow.xaml: <Window
I have a div, I want to set it so that when I click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.