PC Review


Reply
Thread Tools Rate Thread

Custom Dialog

 
 
deciacco
Guest
Posts: n/a
 
      24th Apr 2007
VS2k5 - C# .NET 2

I would like to create my own custom dialog that behaves like the
FolderBrowserDialog. In other words, I would like to be able to go to the
ToolBox, select my custom dialog and drop into my form designer. Then set
some properties from within code before calling the showDialog method. I'm
not trying to recreate the FolderBrowserDialog. Just my own custom dialog
that captures some data.

example:
this.customDialog.customProperty = false;
this.customDialog.customProperty2 = 5;
this.customDialog.showDialog(this);
this.textBox1.text = this.customDialog.getValue();

Thanks.


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      24th Apr 2007
The best way to do this would be to create a class that derives from
CommonDialog, and then override the RunDialog method to show your dialog
when it is called.

See the documentation for the CommonDialog class (in the
System.Windows.Forms namespace) for more information on how to do this.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"deciacco" <(E-Mail Removed)> wrote in message
news:5c2dnYjOBpki7bPbnZ2dnUVZ_o-(E-Mail Removed)...
> VS2k5 - C# .NET 2
>
> I would like to create my own custom dialog that behaves like the
> FolderBrowserDialog. In other words, I would like to be able to go to the
> ToolBox, select my custom dialog and drop into my form designer. Then set
> some properties from within code before calling the showDialog method. I'm
> not trying to recreate the FolderBrowserDialog. Just my own custom dialog
> that captures some data.
>
> example:
> this.customDialog.customProperty = false;
> this.customDialog.customProperty2 = 5;
> this.customDialog.showDialog(this);
> this.textBox1.text = this.customDialog.getValue();
>
> Thanks.
>
>



 
Reply With Quote
 
deciacco
Guest
Posts: n/a
 
      24th Apr 2007
This is what I have so far, but when I go to view it in the designer I get
this error:
"The designer must create an instance of type
'System.Windows.Forms.CommonDialog' but it cannot because the type is
declared as abstract."

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace MyControls
{
public sealed class MyDialog : CommonDialog
{
public MyDialog()
{

}

public override void Reset()
{

}

protected override bool RunDialog(IntPtr hWndOwner)
{
return true;
}
}
}


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Custom Dialog Box =?Utf-8?B?bm9zcGFtaW5saWNo?= Microsoft Excel Programming 3 26th Jan 2006 08:52 PM
Custom Dialog box Subodh Sohoni Microsoft Dot NET 1 22nd Sep 2005 08:54 AM
VS2003 Setup projects custom dialog or dialog with combobox =?Utf-8?B?QWxleGV5IFlha292bGV2?= Microsoft Dot NET 0 18th Feb 2005 03:19 PM
Custom dialog box Noguy Microsoft Access Form Coding 0 25th Aug 2004 09:58 PM
how can i use built-in dialog icons in a custom dialog form? K. Shier Microsoft Dot NET Framework Forms 0 12th Aug 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:58 AM.