473,797 Members | 3,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scheduled VB.NEt program

I'm having problems using Windows Task scheduler (or AT or SCHTASKS) to
run a VB.NET program unattended.

I'm able to reduce it to some really simple code that still fails

My program has a Sub Main something like

Sub Main()

MainForm.showdi alog

End Sub

In MainForm the New() does execute, but code in the MainFormLoad event
doesn't. I then get a System.InvalidO perationExcepti on in the Eventlog
for that machine.

Why is this so hard, when VB6 can do this no problem?

Thanks

Rob
Dec 5 '07
17 2715
Could you write a separate program for the user interface? You could have
the UI program start the processing program.

Andrew
Dec 6 '07 #11
Armin Zingler wrote:
>
I remember an awesome basic discussion about that...

Some say: "Why not do something doesn't make sense but that doesn' hurt?"
I say: "Why do something that doesn't has to be done, even if it doesn't
hurt?"
Armin

Well Imagine you and I are in a room together and you are counting out
loud. If I leave the room do you *have to* stop talking out loud (but
continue counting) just because I'm not there?

At the end of the day I *have* fixed my code so that it runs without any
UI. It just seems a shame that I need to do this on a program that may,
or may not have somebody watching it.

If I'd set out to write a service then clearly all discussion of "what's
the point..." would have been valid.

Environment.Use rInteractive

Didn't know that one. I'll try it out.

Thanks for the help. I have to say developing this stuff is a pain
because I have to keep scheduling a task, logging out, and twiddling my
fingers. Its *really* boring !

Rob

Dec 6 '07 #12
I have been reading you alls post waiting for a work around but all I see is "why show the ui?", so here is my answer. I have the exact problem and I have to have a ui when no one sees it because I get a bunch of data from the db and manipulate it and then using that draw a graph on the winform. Then converting the form(frame) to a bitmap and saving it on the hard drive. Then I send out a email with the .bmp attached. This works perfect while I am logged in but when I am not it does not draw so it does not save so it does not send it as an attachment. So now that I have answered why you would need a winform when no one can see it, can anyone provide me with a work around, I would appreciate it.
Dec 7 '07 #13
Draw your graph directly to a bitmap.
"Bryan" wrote in message news:u6******** ******@TK2MSFTN GP04.phx.gbl...
>I have been reading you alls post waiting for a work around but all I see
is "why show the ui?", so here is my answer. I have the exact problem and
I have to have a ui when no one sees it because I get a bunch of data from
the db and manipulate it and then using that draw a graph on the winform.
Then converting the form(frame) to a bitmap and saving it on the hard
drive. Then I send out a email with the .bmp attached. This works perfect
while I am logged in but when I am not it does not draw so it does not save
so it does not send it as an attachment. So now that I have answered why
you would need a winform when no one can see it, can anyone provide me with
a work around, I would appreciate it.
Dec 7 '07 #14
I thought I've sent this already earlier...

"LittleRob" <gr************ *@greymouse.co. ukschrieb
Armin Zingler wrote:

I remember an awesome basic discussion about that...

Some say: "Why not do something doesn't make sense but that doesn'
hurt?" I say: "Why do something that doesn't has to be done, even
if it doesn't hurt?"

Armin

Well Imagine you and I are in a room together and you are counting
out loud. If I leave the room do you *have to* stop talking out loud
(but continue counting) just because I'm not there?
Yes, because I mustn't talk if you're not there. These are the rules for the
room that you are currently ignoring. Look at the docs
(Environment.Us erInteractive property):

"If this property is false, do not display modal dialogs or message boxes
because there is no graphical user interface for the user to interact with."
The plattform SDK clearly states:

"The interactive window station, Winsta0, is the only window station that
can display a user interface or receive user input. It is assigned to the
logon session of the interactive user, and contains the keyboard, mouse, and
display device."

http://msdn2.microsoft.com/en-us/library/ms687096.aspx

I must admit I'm not a specialist in this, so you'd have to read it up on
your own. Maybe the link is a starting point.

At the end of the day I *have* fixed my code so that it runs without
any UI. It just seems a shame that I need to do this on a program
that may, or may not have somebody watching it.

If I'd set out to write a service then clearly all discussion of
"what's the point..." would have been valid.

Environment.Use rInteractive

Didn't know that one. I'll try it out.

Thanks for the help. I have to say developing this stuff is a pain
because I have to keep scheduling a task, logging out, and twiddling
my fingers. Its *really* boring !
I don't understand. What's the problem? You only have to not show the Form
if no user is logged in.
Armin

Dec 7 '07 #15
>Draw your graph directly to a
>bitmap.
How do I draw directly to a bitmap.
I am using GDI+ and to my understanding it is used to draw on
the form, which then can be saved
to a bitmap. If this is not true,
how do you write directly to a
bitmap. I am currently doing it
in the OnPaint() but since it runs
when I am not logged it in never runs the OnPaint(). Here is my
code sample:
protected override void OnPaint(PaintEv entArgs pe)
{
Graphics graph = pe.Graphics;
Bitmap bmp =
new Bitmap(this.Siz e.Width,
this.Size.Heigh t);
graph = Graphics.FromIm age(bmp);
frameView.Image = bmp;
frameView.Refre sh();
bmp.Save(strDir );
}

Any help would be appreciated!!!
Dec 10 '07 #16
<Bryanschrieb
Draw your graph directly to a
bitmap.

How do I draw directly to a bitmap.
Create a graphics object by calling Graphics.FromIm age.

see also:
http://msdn2.microsoft.com/en-us/lib...07(VS.90).aspx

Don't forget to dispose the Graphics object (like in the example).

Armin
Dec 11 '07 #17
>>Create a graphics object by calling >>Graphics.From Image.
>>see also:
http://msdn2.microsoft.com/en-us/lib...07(VS.90).aspx
>>Don't forget to dispose the >>Graphics object (like in the example).
Thank you...
Dec 11 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4776
by: Bart Simpson | last post by:
Hi, I want to control 'Scheduled Tasks' in Windows 2003 by python program. But I couldn't find any Python module about win32 'Scheduled Tasks'. I could find only Perl module about it. (see http://taskscheduler.sourceforge.net) But, I want to control 'Scheduled Tasks' by python :) Is there any python module about win32 'Scheduled Tasks'?
2
2325
by: G | last post by:
I am trying to duplicate the printing of a shortcut-print of an access report in my NT Scheduled Tasks. I can now print the report manually very easily by right-clicking on a shortcut to the access report and then selecting print. I tried placing the following in the scheduled task, but the ms access ‘97 help does not list /print as an option: "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "E:\dbsfolder\\sales.mdb" /print...
4
5040
by: DFS | last post by:
I have two nightly scheduled jobs at a client site - one at 2:00am and the other at 5:00am Both jobs launch Access 2003, log into the default system workgroup, open a Access .mdb that collects data, then shuts down. Except for the scheduled time and file paths, the job settings are identical. The machine is password-protected, so when each job was created the password was entered.
11
15428
by: Max | last post by:
I'm writing a program that needs to be able to create custom .job files and add them to the scheduled tasks folder. What I'd like to know is, what is the format of a .job file and how do I go about adding in all the data so that the task could run correctly? If that is something not so easy to do, then say I need a certain part of my program to execute on a schedule... How do I go about writing some internal scheduling routine that won't...
9
2273
by: helpful sql | last post by:
Hi all, I want to write a .Net solution that I would like to run as a scheduled task in windows. I am not going to need any user interface. What I don't understand is what kind of project I need to create in Visual Studio for this solution. Is it Console App, Windows App, Class Library or Windows Service? Please help. Also any sample code would be helpful too. Thanks in advance.
0
4237
by: Satish | last post by:
Scheduled Tasks (.Net ) does not run when server is logged off (Windows 2003): I have a .net executable (command line exe) which performs certain business operations. I can run the program (scheduled or manually) without a problem if I am logged in. But when i log off and and set it up as a scheduled task using the Task Scheduler, I receive the following error. Event Type: Error
2
3118
by: Tatter | last post by:
I have a simple .NET 1.1 console application, written with Visual Studio .NET 2003, that needs to be run on a Windows XP system as a scheduled task. When run on its own, the program executes with no errors. When run as a scheduled task on a computer with debugging tools installed, it runs with no errors. When run as a scheduled task on a computer with no debugging tools installed, namely the Windows XP system it is supposed to be run on, it...
0
1985
by: Paulson | last post by:
Dear Freinds I want to make a program that acts as a reminder for the users.I need to open up the Scheduled task wizard programmatically.If you type Tasks in the run command the Tasks folder(ie. Scheduled Taks folder) is opened,but what I want is to open the Add Scheduled Task wizard in it.Is there any run command to do that? Also if I am able to open the Scheduled Task wizard like this is there any way by which I can...
3
1789
by: Dean Slindee | last post by:
Need to write a standalone application that processes data once per day. Looking for the application program types available that would satisfy these requirements: Requirements: 1. Unattended processing that looks for rows in tables in a SQL Server database that is updated in batch once per day via another company's daily process. The newly added rows are selected based on a process date parameter (see #4). 2. Cleans and reformats the...
1
4274
by: ranjitw | last post by:
I am running backup to .mdb file on a Windows 2003 server . My issue is that when the program completed it still is in a "running" state when I highlight the icon for the scheduled task I have to manually stop the task in order for the next scheduled backup to run. Is there a command line switch that I can use to force quit the program after it is completed or even if the job does not complete. Thanks for your help in advance
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9066
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.