如何编写此事件的代码? [英] How does the need to code this event?

查看:79
本文介绍了如何编写此事件的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在执行程序时给出一个特定的事件.

例如,

C:\ download \ program.exe-任务栏

如上,如果遵循路径``-####''

``-####''在事件程序中用于

我该怎么办?



(对不起,我使用Translater)

I would like to give a specific event when executing the program.

For example,

C:\download\program.exe -Tray

As above if have followed the path ''-####''

''-####'' In the event program for.

How Can I Did?



(Sorry, I using Translater)

推荐答案

您似乎希望在应用程序中使用命令行参数,以获取为Win Form应用程序传递的值,您可以使用;
It would appear you want to use command line arguments in your application, to get the values passed for a win form application you can use;
For Each arg As String In Environment.GetCommandLineArgs()
    'Do something here if the command you want is found.
Next arg



对于控制台应用程序,您可以使用以下方法来替代main方法:



For a console application you can over ride the main method with;

Shared Sub Main(ByVal args As String())
    For Each arg As String In args
        'Do something here if the command you want is found.
    Next arg

End Sub




阅读本文 [




Read this article[^] as well.


您想在哪里举办活动?您可以在代码中告诉您传递的路径,但这并不是真正的事件",您只需响应该值即可.
Where do you want to give an event ? You can tell what path you were passed in, in your code, but that''s not really an ''event'', you just respond to the value if it''s what you expected.


您应该编辑自己的帖子以添加详细信息,如果您未回答,则不要推送答案.您的应用程序将传递给您的参数.您可以将它们存储在变量中,然后在表单加载事件中引用它们,这是您必须在应用程序中编写的代码.任何时候只要您想要基于某人的传入行为来做某事,只要您存储了它就可以.至少根据您之前所说的,这并没有引发任何事件.这是一项基本的编程任务,存储值,检查值并对其值进行操作.您的问题可能会在翻译中迷失,但我认为您只需要参加基础课或购买基础书即可.如果我不完全了解您,请发布一些代码并附上您要添加的内容,这可能有助于我理解您的要求.
You should edit your post to add detail, not push answer if you''re not answering. Your application is passed the parameters you pass into it. You can store those in a variable, and then refer to them in your form load event, which is something you have to code into your application. Any time you want to do something based on what someone passed in, you can, so long as you stored it. This is not raising an event, at least, not according to what you''ve said before. It''s a basic programming task, store the value, check it, and act on it''s value. It''s possible your question is being lost in translation but I think you just need to take a basic class or buy a basic book. If I''m not fully understanding you, posting some code with a comment of what you want to add, may help me to understand what you''re asking.


这篇关于如何编写此事件的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆