473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I work with WIndows Forms in WPF?

complete
11 New Member
In my WPF program I created a Windows Form class.
In this Form, I placed an OK button and I went into the properties of the button and set the DialogResult to OK.
Now, I am calling this Dialog (Window Form) from the MainWindow.xaml.cs:
Expand|Select|Wrap|Line Numbers
  1.                         dres = form.ShowDialog();
  2.                         if (dres != DialogResult.OK) return;
The compiler is complaining:

Expand|Select|Wrap|Line Numbers
  1. Error    3    'System.Nullable<bool>' does not contain a definition for 'OK' and no extension method 'OK' accepting a first argument of type 'System.Nullable<bool>' could be found (are you missing a using directive or an assembly reference?)
May 26 '10 #1
3 2814
Plater
7,872 Recognized Expert Expert
Sounds like ShowDialog() in that context returns a type "bool?" (nullable bool)
May 26 '10 #2
ThatThatGuy
449 Recognized Expert Contributor
@complete
Form.ShowDialog() here returns nullable bool...

and not a value supported by the enum DialogResult..

Dialog Result objects can be returned only by SaveFileDialog,FolderBrowserDialog,OpenFileDialog. . etc

It doesn't apply on custom made dialogs..
May 28 '10 #3
Plater
7,872 Recognized Expert Expert
Well in regular windows programing, anything that inherits from the Form object (so all of your custom forms) supports the ShowDialog() function with a return value of type DialogResult. Why it is NOT done that way in WPF is not something I know, but it seemed perfectly resonable it would work.
May 28 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: KK | last post by:
Windows Forms Inheritance, Incomplete? I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can be used effectively if the...
6
by: Ayende Rahien | last post by:
Excetremely annoying problem, I've an application with a long startup time. So I created another form with my logo in it to as a splash screen. The splash screen is run from another thread and is...
4
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
2
by: fperfect13 | last post by:
Hi, I have the folowing exception Exception : System.NullReferenceException: Object reference not set to an instance of an object. 00000019 3:30:48 PM at...
0
by: Sanjeeva Reddy | last post by:
1)how to get the preview of movie file to add in imagelist(i mean the first frame of movie file. )(in .net frame work,windows Forms application) in a listview control. here i am giving code for...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
2
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
0
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.