Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi....I am trying to access a windows form from a web form. I created an instance of the window form. But it giving me an error like this:

 

--------------------------------------------------------------------------

It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

 

Source Error:

 

 

Line 35: dlg = New Morphic.ISS.Common.BrowseFolders

Line 36:

Line 37: If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then

Line 38: Dim info As DirectoryInfo = dlg.info()

Line 39: txtFullpath.Text = dlg.FullPath

 

 

--------------------------------------------------------------------------

This is how I defined the New() method for the windows form:

--------------------------------------------------------------------------

Public Sub New()

MyBase.New()

 

'This call is required by the Windows Form Designer.

InitializeComponent()

 

'Add any initialization after the InitializeComponent() call

FillTree()

 

End Sub

--------------------------------------------------------------------------

 

And this how I am calling the above New() method from a web form:

 

--------------------------------------------------------------------------

Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

Dim dlg As BrowseFolders

dlg = New BrowseFolders

 

If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then

Dim info As DirectoryInfo = dlg.info()

txtFullpath.Text = dlg.FullPath

End If

--------------------------------------------------------------------------

 

 

Does anyone find anything wrong in the way I am calling the windows form from the web form???

 

- SJ.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...