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 7815587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:34:04+00:00 2026-06-02T05:34:04+00:00

Really new and learning C# and following along some training video from PluralSight. Great

  • 0

Really new and learning C# and following along some training video from PluralSight. Great videos, except you cannot ask questions, of course and I am not understanding why what I am seeing is different that what his screen is displaying even though I typed exactly what he has.

Textbox is named “Output”. Initially, the actions were directly in the MainWindow constructor (which he explained is not good practice, so we moved it. Initially, this worked as it should:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            Employee e1 = new Employee();
            e1.Name = "Mike";

            Employee e2 = new Employee();
            e2.Name = "Miller";

            Output.Text = e1.Name + " " + e2.Name;


        }
    }
}

This would display “Mike Miller” in the TextBlock.

However, when we moved it to this, all it says for the text is “TextBlock”

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {

            Employee e1 = new Employee();
            e1.Name = "Mike";

            Employee e2 = new Employee();
            e2.Name = "Miller";

            Output.Text = e1.Name.Length + " " + e2.Name.Length;

        }

    }
}

Am I missing something simple here?

Thanks!

  • 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. Editorial Team
    Editorial Team
    2026-06-02T05:34:07+00:00Added an answer on June 2, 2026 at 5:34 am

    As Nico Schertler stated, verify that you subscribed to Loaded event of Window:

    <Window ... Loaded="MainWindow_Loaded">
        ...
    </Window>
    

    In first case your code runs, because constructor of Window is called when Window is created. In second case, event handler is not called by default. You should subscribe to this event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am really new to java (started learning 2 days ago). Sorry if this
So, I'm new to shell scripts and I'm really doing this as a learning
I am new to DirectX11 and learning it. (I come from openGL background). I
So I'm really new to programming, I just started learning Python yesterday and I'm
I'm really new to java and slowly learning so not sure if there is
Hey I am really new to the field of machine learning and recently started
I'm pretty new to java and really enjoying learning about it. I have made
I'm learning Rails and fairly new to Macports. I receive the following error when
I am new to SQL Server and currently learning it. I got following stored
I come from python background and am learning ruby. IPython is really awesome. I

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.