Results 1 to 3 of 3

Thread: New to WPF

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    New to WPF

    I have been programming in VB6 for quite a while and moving to VB 2010 and WPF and have a couple of questions that need an answer to. 1) In VB6 I could reference a textbox on Form1 in Form2 to get the value from it, but don't see how to do this in WPF. I am actually using Windows in WPF instead of Forms. 2) I also need to know how to go from Form1 to Form2 and thn back to Form1. The only way I can see to load Form2 is to Dim Form2 as New Form2 and then Form2.Show. If I were to do this to get back to Form1, that would create a new instance of the form instead of taking me back to the one that is already open.

    Any help will be greatly appreciated!

    Charles

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: New to WPF

    1. You're not using Windows instead of Forms. WPF doesn't have Forms. A WPF Window is the equivalent of a Form from Windows Forms or what was used in VB6. If you're using WPF then you're using Windows, plain and simple.

    In Windows Forms you have two ways to access the default instance of a Form. You can use the long-hand:
    vb.net Code:
    1. My.Forms.SomeForm.Show()
    or the short-hand:
    vb.net Code:
    1. SomeForm.Show()
    In WPF you only have the long-hand:
    vb.net Code:
    1. My.Windows.SomeWindow.Show()
    2. If you call Show on a Window then it returns immediately. If you call ShowDialog then it will block until the dialogue is closed.

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: New to WPF

    If I were to do this to get back to Form1, that would create a new instance of the form instead of taking me back to the one that is already open.
    Sounds like you simply want to close the second window, which you do by just doing this from the second window:
    vb Code:
    1. Me.Close
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width