Error when Running App with Scheduled Task

  • Thread starter Thread starter Ryan
  • Start date Start date
R

Ryan

Error: Showing a modal dialog box or form when the application is not running
in UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a notification
from a service application.

In the Main module; I have the following lines of code (VS 2008) which shows
a minimized form; executes the code and closes the form.

Sub Main()
Dim custForm As New CustomerForm
custForm .ShowDialog()
End Sub
 
Error: Showing a modal dialog box or form when the application is not running
in UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a notification
from a service application.

In the Main module; I have the following lines of code (VS 2008) which shows
a minimized form; executes the code and closes the form.

Sub Main()
Dim custForm As New CustomerForm
custForm .ShowDialog()
End Sub

If it is a task running when there is no user, why show the form? Just
put your code into a console app. It sounds like it should be a service
though.
 
The application can also be run with command line arguments which then brings
up the user interface.
 
The application can also be run with command line arguments which then brings
up the user interface.

But you stated that it is always showing the form. (the show dialog
above is always executed).

Can you move the operational code out of the gui and call it directly
from the console app under one run condition. During another condition,
launch the GUI and have it call the same operational code.
 
Ryan said:
Error: Showing a modal dialog box or form when the application is not running
in UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a notification
from a service application.

In the Main module; I have the following lines of code (VS 2008) which shows
a minimized form; executes the code and closes the form.

Sub Main()
Dim custForm As New CustomerForm
custForm .ShowDialog()
End Sub

I don't know how you can get away with it as some NT scheduled task. If
it's a task, then it should not interact with a user an unattended task,
otherwise, you get the error.

At best, you should remove the code from the form to an area that is
accessible by the application running as a form app, but the same code
can be accessed by the application as an unattended task.

You pass a parm on application startup of 'attended' or 'unattended' so
the program knows the execution path to take,
 
Back
Top