Avatar of slightlyoff
slightlyoff
 asked on

VB.NET WPF and Controling controls on different windows

I'm new to WPF and I'm struggling with some basic databinding and window sharing concepts.  In windows forms, controlling objects on other windows was easy.  In WPF, I can't seem to get it to work.

For example, I have three windwos at the moment:

1. MainWindow
2. LoginStart
3. ControlPanel

MainWindow is mostly what I'm using for the background and to display messages.  I have a label in the upper right hand corner for messages, called "lblInfo".  I also have a button in the lower right that is labeled "Login" - clicking this opens LoginStart.

LoginStart is a 12 button form, with a textbox for logging in.  The buttons are numbered like a keypad, with CLR and GO at the bottom.  CLR erases what's in the textbox, and GO submits the information for processing.

LoginStart is a transparent window, so the buttons just appear as if they are part of MainWindow.  When someone logs in, I want the name of the person to appear in lblInfo on MainWindow.

I thought I'd accomplish this in loginStart.xaml.vb using:
mw = new MainWindow
mw.lblInfo.Content  = FirstName & " " & LastName & " is now logged in."

Open in new window


I don't have any errors when I run this, it just doesn't do anything.

I've read tutorials and watched youtube videos on databinding, and it seems like that's the answer, but it also seems like all the suggestions I've read are much more complex than they need to be.  They're also in C#, which I'm learning, but not totally comfortable with.

So in short, my question is, what do I need to do to access controls on other windows using WPF?

Thanks for your help!!!
Visual Basic.NET

Avatar of undefined
Last Comment
slightlyoff

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
MikeToole

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
slightlyoff

ASKER
Thanks Mike,

I think you're right.  I'm working on learning MVVM.  Thanks for the help!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck