By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,908 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,908 IT Pros & Developers. It's quick & easy.

About usercontrol in .NET

P: n/a
Hi all,

I have a problem regarding use of a usercontrol in .NET.
My usercontrol consists of two listviews which I say as source and
destination lisviews which
contains the files and folders.
I select files from source view and transfer it to the destination
view.The problem arises while
displaying the dialog for overwriting the file or folder if it is
present on the other side.

The overwrite form which I want to display should be modal. Otherwise
it could delete the
files or folders in the background view. I don't want to use a flag
which will block the deletion
if transfer is going on. The overwriteDialog should not allow me to
shift the focus elsewhere.

The problem is when i display the dialog using
_overwriteFile.showDialog() '_overwriteFile is a object of
OverwriteFile

It is not getting displayed as modal.Remember the parent for the dialog
is a usercontrol.
I have even tried with displaying it by _overwriteFile.showDialog(Me).
But still the problem
persists.

Is it that we cannot display a modal dialog on a usercontrol?

I have also used one third party control of Magiclibrary's docking
manager which is the container for my usercontrol.

Somewhere on the posts I have read that third party controls also play
role while displaying the modal dialogs.If anyone has any idea abt this
control and is there any relevance with the
problem I am facing plz. do reply

Thanks in advance.
Imm. reply needed plz. do reply.

Dec 27 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

There should not be any problems displaying a modal
form from a usercontrol (I just tried it):

Public Class ModalTestUserControl
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim frm As New MyModalForm
frm.ShowDialog()
End Sub
End Class

Form is being displayed modally and behaves as it should.

The only thing you should not do is display a non-modal
form from a modal dialog. Modal from modal or modal from
non-modal should be fine.

I think you need to isolate the problem: Create a new form,
set this form as the startup form in the project properties, then
test an instance of your usercontrol on that form.

Just to find out if the problem is with the usercontrol, rather
than the docking framework or some interaction problems with
the usercontrol and the docking framework.

/JB

On 27 Dec 2005 06:59:24 -0800, "sonu" <so*************@yahoo.com>
wrote:
Hi all,

I have a problem regarding use of a usercontrol in .NET.
My usercontrol consists of two listviews which I say as source and
destination lisviews which
contains the files and folders.
I select files from source view and transfer it to the destination
view.The problem arises while
displaying the dialog for overwriting the file or folder if it is
present on the other side.

The overwrite form which I want to display should be modal. Otherwise
it could delete the
files or folders in the background view. I don't want to use a flag
which will block the deletion
if transfer is going on. The overwriteDialog should not allow me to
shift the focus elsewhere.

The problem is when i display the dialog using
_overwriteFile.showDialog() '_overwriteFile is a object of
OverwriteFile

It is not getting displayed as modal.Remember the parent for the dialog
is a usercontrol.
I have even tried with displaying it by _overwriteFile.showDialog(Me).
But still the problem
persists.

Is it that we cannot display a modal dialog on a usercontrol?

I have also used one third party control of Magiclibrary's docking
manager which is the container for my usercontrol.

Somewhere on the posts I have read that third party controls also play
role while displaying the modal dialogs.If anyone has any idea abt this
control and is there any relevance with the
problem I am facing plz. do reply

Thanks in advance.
Imm. reply needed plz. do reply.


Dec 27 '05 #2

P: n/a
I have the same issue. The problem is, that the dialog doesn't get hidden
behind the form all the time. Most of the time, it's fine, and it stays on
top. But many times it does get hidden behind the form. So the form is
unusable, because there is an unclosed dialog. But the dialog is not visible
and there is no other way to get to it, other then Alt_Tab and selecting the
application. The the dialog appears.

I haven't been able to figure out a pattern of why this might happen or
when. It just sort of happens sometimes, and I have to figure there is
something going on in the OS, and that is affecting the dialog.

"Joergen Bech @ post1.tele.dk>" <jbech<NOSPAMNOSPAM> wrote in message
news:33********************************@4ax.com...

There should not be any problems displaying a modal
form from a usercontrol (I just tried it):

Public Class ModalTestUserControl
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim frm As New MyModalForm
frm.ShowDialog()
End Sub
End Class

Form is being displayed modally and behaves as it should.

The only thing you should not do is display a non-modal
form from a modal dialog. Modal from modal or modal from
non-modal should be fine.

I think you need to isolate the problem: Create a new form,
set this form as the startup form in the project properties, then
test an instance of your usercontrol on that form.

Just to find out if the problem is with the usercontrol, rather
than the docking framework or some interaction problems with
the usercontrol and the docking framework.

/JB

On 27 Dec 2005 06:59:24 -0800, "sonu" <so*************@yahoo.com>
wrote:
Hi all,

I have a problem regarding use of a usercontrol in .NET.
My usercontrol consists of two listviews which I say as source and
destination lisviews which
contains the files and folders.
I select files from source view and transfer it to the destination
view.The problem arises while
displaying the dialog for overwriting the file or folder if it is
present on the other side.

The overwrite form which I want to display should be modal. Otherwise
it could delete the
files or folders in the background view. I don't want to use a flag
which will block the deletion
if transfer is going on. The overwriteDialog should not allow me to
shift the focus elsewhere.

The problem is when i display the dialog using
_overwriteFile.showDialog() '_overwriteFile is a object of
OverwriteFile

It is not getting displayed as modal.Remember the parent for the dialog
is a usercontrol.
I have even tried with displaying it by _overwriteFile.showDialog(Me).
But still the problem
persists.

Is it that we cannot display a modal dialog on a usercontrol?

I have also used one third party control of Magiclibrary's docking
manager which is the container for my usercontrol.

Somewhere on the posts I have read that third party controls also play
role while displaying the modal dialogs.If anyone has any idea abt this
control and is there any relevance with the
problem I am facing plz. do reply

Thanks in advance.
Imm. reply needed plz. do reply.

Dec 27 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.