如何在一个应用程序中选择不同的程序 [英] How to select different program in one app

查看:75
本文介绍了如何在一个应用程序中选择不同的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有时间硬编码的应用程序,我想复制该应用程序更改时间并将其添加回来。所以现在当我运行应用程序时,我可以选择运行应用程序1或运行应用程序2.我将如何做到这一点?



基本上我想采用相同的程序并且它在原版内部,但有不同的信息。



谢谢



我试过的:



环顾网络,但我真的不知道要搜索什么词汇。

I have a app that has times hard coded, i would like to copy that app change the times and add it back. so now when i run the app i can select run app 1 or run app 2. How would i do that?

basically I want to take the same program and lay it inside of the original but with different information.

Thanks

What I have tried:

looking around the net but i really dont know what verbiage to search for.

推荐答案

您不需要两个不同的应用程序。您只需提供菜单选项或按钮选择器,以允许用户选择一组或其他一组时间。您甚至可以使用一个 MessageBox 来完成。然后在应用程序内部选择用户指定的任何一组时间。
You do not need two different apps. You just need to provide a menu choice or button selector to allow the user to select one or other set of times. You could even do it with a single MessageBox. Then inside the app just select whichever set of times the user has indicated.


如果您想要2个不同的应用程序,那么您需要创建2个单独的项目,这些项目将被编译为2个可执行文件。 />


如果您希望能够根据选择运行2种不同的表单,那么将2个新表单添加到原始项目中(假设您已经有一个)= 3总计,一个用于放置用户将选择选择运行哪个app的按钮或链接。其他形式是具有硬编码值的形式。一个链接/按钮/等打开app1,另一个链接/按钮/等打开app2。



并且需要事件处理程序来处理点击事件。
If you want 2 different apps then you need to make 2 separate projects that will be compiled into 2 executables.

If you want the ability to run 2 different forms depending on a selection, then add 2 new forms to the original project (assuming you already have the one)= 3 total, one being for placing buttons or links that the user will select to pick which "app" to run. The other forms are those with the hard coded values. One link/button/etc opens "app1", the other link/button/etc opens "app2".

And yes event handlers will be needed to handle the click events.


我不得不笑,因为你正在准确地说出你遇到这个问题的原因。你一直想说你已经将硬编码硬编码到你的应用程序中了,你现在想知道如何制作另一个具有不同硬编码值的表格。



不要做那!!!!!!硬编码值将您锁定在您所处的状态!!



您应该做的是将这些值放入配置文件中,然后将它们加载为不同情况所需。现在您只需要一个可以处理这些不同情况的表单。您所要做的就是提供一个菜单项,以便从配置文件中选择要加载到表单中的值集。
I have to laugh because you're spelling out precisely why you're in this problem. You keep saying that you "hard coded" things into your app now you want to know how to make another form with different "hard coded" values.

DO NOT DO THAT!!!!!! Hard coding values locks you into the very situation that you're in!!

What you should have done is put these values into a configuration file and then loaded them as required for different situations. Now you only need one form that can handle these various situations. All you have to do is supply a menu item to pick which set of values to load from the configuration file into the form.


这篇关于如何在一个应用程序中选择不同的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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