Error when Running App with Scheduled Task

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
 
F

Family Tree Mike

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.
 
R

Ryan

The application can also be run with command line arguments which then brings
up the user interface.
 
F

Family Tree Mike

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.
 
M

Mr. Arnold

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top