预定的VB.NEt程序

编程入门 行业动态 更新时间:2024-10-28 09:15:38
本文介绍了预定的VB.NEt程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在使用Windows任务调度程序(或AT或SCHTASKS)时遇到问题 无人值守运行VB.NET程序。 我'能够将它减少到一些仍然失败的非常简单的代码 我的程序有一个Sub Main类似的东西 Sub Main() MainForm.showdialog 结束子 在MainForm中New()执行,但MainFormLoad事件中的代码 不是。然后我在事件日志中得到一个System.InvalidOperationException 。 为什么这么难,当VB6可以做到这一点没问题? 谢谢 Rob

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.showdialog End Sub In MainForm the New() does execute, but code in the MainFormLoad event doesn''t. I then get a System.InvalidOperationException in the Eventlog for that machine. Why is this so hard, when VB6 can do this no problem? Thanks Rob

推荐答案

关于哪些陈述失败了? IMO它更可能是由执行上下文引起的,而不是由VB6与VB.NET问题引起的。例如,尝试在服务帐户下使用 打印机的应用程序可能会失败,因为在这种情况下用户配置文件 未加载且没有默认打印机可用... " LittleRob" < gr ************* @greymouse.co.ukaécritdansle message de news: 5r ************* @ mid.individual ... On which statements does it fail ? IMO it is caused more likely by the execution context rather than by some VB6 vs VB.NET issue. For example an application that would try to use the printer under a service account could fail as in this case the user profile is not loaded and sop there are no default printers available... "LittleRob" <gr*************@greymouse.co.uka écrit dans le message de news: 5r*************@mid.individual... 我在使用Windows任务调度程序(或AT或SCHTASKS)时遇到问题 无人值守运行VB.NET程序。 我能够将它减少到一些仍然失败的非常简单的代码 我的程序有一个Sub Main类似的东西 Sub Main() MainForm.showdialog End Sub 在MainForm中New()确实执行,但MainFormLoad事件中的代码 不行。然后我在事件日志中得到一个System.InvalidOperationException,用于 那台机器。 为什么这么难,当VB6可以做到这一点没问题? 谢谢 Rob 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.showdialog End Sub In MainForm the New() does execute, but code in the MainFormLoad event doesn''t. I then get a System.InvalidOperationException in the Eventlog for that machine. Why is this so hard, when VB6 can do this no problem? Thanks Rob

Patrice写道: Patrice wrote: 哪些语句失败? IMO它更可能是由执行上下文而不是某些 VB6 vs VB.NET问题。例如,尝试在服务帐户下使用 打印机的应用程序可能会失败,因为在这种情况下用户配置文件 未加载且没有默认打印机可用... " LittleRob" < gr ************* @greymouse.co.ukaécritdansle message de news: 5r ************* @ mid.individual ... On which statements does it fail ? IMO it is caused more likely by the execution context rather than by some VB6 vs VB.NET issue. For example an application that would try to use the printer under a service account could fail as in this case the user profile is not loaded and sop there are no default printers available... "LittleRob" <gr*************@greymouse.co.uka écrit dans le message de news: 5r*************@mid.individual... >我在使用Windows任务调度程序(或AT或SCHTASKS)在无人值守的情况下运行VB.NET程序时遇到问题。 我'能够将它减少到一些仍然失败的非常简单的代码 我的程序有一个Sub Main类似的东西 Sub Main() MainForm.showdialog 结束子 在MainForm中,New()确实执行,但MainFormLoad事件中的代码没有。然后我在事件日志中为那台机器获得了一个System.InvalidOperationException。 为什么这么难,当VB6可以做到这一点没问题? 谢谢 Rob >I''m having problems using Windows Task scheduler (or AT or SCHTASKS) torun a VB.NET program unattended.I''m able to reduce it to some really simple code that still failsMy program has a Sub Main something likeSub Main()MainForm.showdialogEnd SubIn MainForm the New() does execute, but code in the MainFormLoad eventdoesn''t. I then get a System.InvalidOperationException in the Eventlog forthat machine.Why is this so hard, when VB6 can do this no problem?ThanksRob

Patrice 感谢您的回复,但是我的任何代码都没有失败。 我添加了一些日志记录: 1.登录Sub Main( )没关系 2.登录表单''s New()是好的 3.登录FormLoad事件永远不会得到执行。 在我看来,如果 代码要从调度程序运行,我就不能显示一个表单(使用.ShowDialog) ,但我不能成为唯一有这个问题的人。实际上,我知道我不是因为我在谷歌时获得了一些 点击,但只有少数,而且从未有过解决方法。 谢谢 Rob

Patrice Thanks for the reply, but it doesn''t fail on any of my code. I added some logging: 1. Logging in the Sub Main() is OK 2. Logging in the form''s New() is OK 3. Logging in the FormLoad event never gets executed. It seems to me that I just can''t show a form (using .ShowDialog) if the code is to run from a scheduler, but I can''t be the only person out there with this problem. Well actually I know I''m not as I do get some hits when I Google, but only a few, and never with a workaround. Thanks Rob

" LittleRob" < gr ************* @ greymouse.co.ukschrieb "LittleRob" <gr*************@greymouse.co.ukschrieb 我在使用Windows任务计划程序时遇到问题(或AT或SCHTASKS) 无人值守地运行VB.NET程序。 我能够将它简化为一些仍然失败的非常简单的代码 我的程序有一个Sub Main类似的东西 Sub Main() MainForm.showdialog 结束子 在MainForm中,New()确实执行,但是MainFormLoad 事件中的代码没有'' T。然后我在该机器的 事件日志中得到一个System.InvalidOperationException。 为什么这么难,当VB6可以做到这一点没问题? 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.showdialog End Sub In MainForm the New() does execute, but code in the MainFormLoad event doesn''t. I then get a System.InvalidOperationException in the Eventlog for that machine. Why is this so hard, when VB6 can do this no problem?

我试了一下它没有错误。当任务 启动时你是否登录?如果你不是,那是不可能的。你必须用UI写一个服务 。 Armin

I tried it and it works without an error. Are you logged-in when the task starts? If you are not, it is not possible. You''d have to write a service w/o a UI. Armin

更多推荐

预定的VB.NEt程序

本文发布于:2023-11-03 12:00:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   VB   NEt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!