473,486 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Custom Dialog

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.
Apr 24 '07 #1
2 7262
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]
- mv*@spam.guard.caspershouse.com

"deciacco" <a@a.comwrote in message
news:5c******************************@giganews.com ...
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.


Apr 24 '07 #2
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;
}
}
}
Apr 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3396
by: Rikkert | last post by:
I can't get my custom-made modeless dialog box (Visual C++.net Win32) to respond to clicking the close button or pressing Alt-F4. I am using the IsDialogMessage to check if messages are for my...
7
15233
by: WindAndWaves | last post by:
Hi Gurus I am trying to make a custom message box with a dialog form. Here is how I would like to do it: 1- anywhere in the database, in any procedure, I call the function that opens a dialog...
2
30119
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
4
8894
by: logicalfeline | last post by:
Hi there, I'm creating an installation project where at a particular point in the installation I want the user to be able to specify a filepath for use in the program. My idea was to create a...
4
1930
by: LhK-Soft | last post by:
Hi, I'm active in VC++ for several years now, so I know some things (I think). Using MS-Access I store a db with lots of entries and uses the VBA techniques to export those data to e.g. HTML, XML...
2
2617
by: J-Rod | last post by:
Hi everyone/anyone, I am using a button in my app that opens the color dialog, and allows the user to select a color which changes the backcolor of a label. I then store the color in my db as a...
3
13502
by: boney.dalwani | last post by:
Hello All, I m new to JavaScript and widely Exploring programming in js i have a situation where in i do not want to use alert(message); / prompt(message) kind of functionility. rather i want...
0
1871
by: Gancy | last post by:
Hi In my setup project I need a custom dialog box containing a drop down list box. Since this is not avaialble from standard user interface dialog boxes that visual studio supplies, I am using...
1
3191
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
9
5467
by: Gord | last post by:
In VB6, a custom dialog can be easily created by adding a new form, adding whatever controls you like, sizing it as you like, adding code and then just loading/unloading it whenever you like....
0
6964
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
7175
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...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7319
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...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4864
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
4559
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
3069
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
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.