I am using Visual Studio 2008 Pro. I have a WPF form and a button. When the user clicks the button, I want to open another window, which is more complex than a simple messagebox - it would query a database to get data and such.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
That's all good, but the problem is that when I close the window and try to show it again, an exception is thrown saying that I cannot open a closing window. If I override the onclosing function and hide the window instead of closing it, the program wouldn't shut down, when I close the main window, because the other window has never been closed.... creating a new instance of the window object every time when I want to show it, wouldn't cut it as well, because then I cannot reference the window object from the main window as it is local to that button_click function.
it's not easy to help you without seeing your masterpiece (you should already know that). so, what about posting some code?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
Assuming you want a modal dialog type of window, it's pretty simple if you use ShowDialog.
To make this even simpler when invoking the dialog, I typically create a static factory method. The code below shows an About dialog (which is a WPF window).
I'd like to have a window that would have a matrix which would be updated with data from an underlying database.
We got that part. The question remains if whether you are looking for a modal dialog approach (as I've given you) or something else. What the window (or form) contains is irrelevent at this point if you are having trouble getting the window to display.
Bookmarks