//Master form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CustomDialoque
{
public partial class MasterForm : Form
{
public MasterForm()
{
InitializeComponent();
}
private void toolStripButtonCallDiloque_Click(object sender, EventArgs e)
{
DialogResult result = (new myDialoque()).ShowDialog(this);
//Put your code within below condition
if (result == System.Windows.Forms.DialogResult.OK)
MessageBox.Show("Dialoque return 'OK'");
else
MessageBox.Show("ELSE");
}
}
}
Code (C#)
//Dialoque form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CustomDialoque
{
public partial class myDialoque : Form
{
public myDialoque()
{
InitializeComponent();
InitNeccessaryCustomDialoque();
}
void InitNeccessaryCustomDialoque()
{
//Can be set via property windows
this.AcceptButton = myOkButton;
this.CancelButton = myCancelButton;
myOkButton.DialogResult = System.Windows.Forms.DialogResult.OK;
myCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.StartPosition = FormStartPosition.CenterParent;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
}
}