From: Ryan on 4 Feb 2010 18:52 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
From: Family Tree Mike on 4 Feb 2010 20:18 On 2/4/2010 6:52 PM, Ryan wrote: > 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. -- Mike
From: Ryan on 5 Feb 2010 10:26 The application can also be run with command line arguments which then brings up the user interface. "Family Tree Mike" wrote: > On 2/4/2010 6:52 PM, Ryan wrote: > > 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. > > -- > Mike > . >
From: Family Tree Mike on 5 Feb 2010 14:00 On 2/5/2010 10:26 AM, Ryan wrote: > The application can also be run with command line arguments which then brings > up the user interface. > > "Family Tree Mike" wrote: > >> On 2/4/2010 6:52 PM, Ryan wrote: >>> 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. >> >> -- >> Mike >> . >> 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. -- Mike
From: Mr. Arnold on 5 Feb 2010 16:25 Ryan wrote: > 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,
|
Pages: 1 Prev: Need to prevent user from leaving program etc... Next: Reading XML file with Linq |