472,126 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

Modal form dialog

Hi there,

I want to create a Modal dialog from.
Normally in vb it won't allow to click the parent form.

But I tried that in C# using form.ShowDialog(this);
I still can click on the mainForm event close the main form.

Does anyone know the trick of this?

Cheers,
Kids
Nov 16 '05 #1
4 1873
Can you send your code snippet please? Because I dont have any problem in
using ShowDialog.
Sree

"kids_pro" <ki******@yahoo.com> wrote in message
news:uP**************@tk2msftngp13.phx.gbl...
Hi there,

I want to create a Modal dialog from.
Normally in vb it won't allow to click the parent form.

But I tried that in C# using form.ShowDialog(this);
I still can click on the mainForm event close the main form.

Does anyone know the trick of this?

Cheers,
Kids

Nov 16 '05 #2
kids_pro wrote:
Hi there,

I want to create a Modal dialog from.
Normally in vb it won't allow to click the parent form.

But I tried that in C# using form.ShowDialog(this);
I still can click on the mainForm event close the main form.

Does anyone know the trick of this?

Sorry,

cannot reproduce this. Are you sure?

private void button1_Click(object sender, System.EventArgs e)
{
Form2 f = new Form2();
f.ShowDialog(this);
}

Cheers

Arne Janning
Nov 16 '05 #3
Oh I know what happen.
Because I put long running procedure in the Modal form.

in MainForm:
Form2 frm = new Form2();
frm.ShowDialog(this);

in Form2_Load(..,..){
this.Visible = true;
// long running part it take about 1 minute or more
// during this period I can click on the parent form and event close it.
// try it out you will see.
this.Close();
}


"Sreekanth" <sr*******@yahoo.com> wrote in message
news:ce**********@news.mch.sbs.de...
Can you send your code snippet please? Because I dont have any problem in
using ShowDialog.
Sree

"kids_pro" <ki******@yahoo.com> wrote in message
news:uP**************@tk2msftngp13.phx.gbl...
Hi there,

I want to create a Modal dialog from.
Normally in vb it won't allow to click the parent form.

But I tried that in C# using form.ShowDialog(this);
I still can click on the mainForm event close the main form.

Does anyone know the trick of this?

Cheers,
Kids


Nov 16 '05 #4
// Oop the actual part to cuz this behavior is Application.Doevents();

this.Visible = true;

for(int i =0; i<20000;i++){

for(int j=0;j<10000;j++){}

Application.DoEvents();

this.Text = i.ToString();

}

}

"Sreekanth" <sr*******@yahoo.com> wrote in message
news:ce**********@news.mch.sbs.de...
Can you send your code snippet please? Because I dont have any problem in
using ShowDialog.
Sree

"kids_pro" <ki******@yahoo.com> wrote in message
news:uP**************@tk2msftngp13.phx.gbl...
Hi there,

I want to create a Modal dialog from.
Normally in vb it won't allow to click the parent form.

But I tried that in C# using form.ShowDialog(this);
I still can click on the mainForm event close the main form.

Does anyone know the trick of this?

Cheers,
Kids


Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by martin de vroom | last post: by
2 posts views Thread by cassidyc | last post: by
10 posts views Thread by Guadala Harry | last post: by

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.