变量来控制整个应用程序? [英] variable to govern the entire application?

查看:101
本文介绍了变量来控制整个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有一个关于vb.net的问题,以及如何..um如何使用一个变量来管理整个应用程序.
好吧,把它分解.
我想知道的例如:

Hello,
I have a question regarding vb.net and how to ..um how to use one variable to govern the entire application.
Ok ill break it down.
What I would like to know can I use for example:

dim strMode as boolean = true
if strMode = true then 'use class test1
if strMode = false then 'use class test2

class test1
 ' this is where all the code will be for the design view
end class

class test2
 ' this is where all the code will be for the design view
end class

'as you can tell i don't have a vb.net editor with me



我知道我可以用这个



I know i can use this

#if 0 then
  somthing will not happen here
#end if
 
#if 1 then
 essagebox.show("Somthing happend")
#end if 



我知道我可以使用其他表格



I know i can use other forms

class test
sub do_somthing
 If bla = true then form2.show else form3.show : me.hide
end sub
end class


但这不是我所追求的.
有什么可能吗?

在这台计算机上,我没有安装VS 2010,是否有像VS 2010或2008的云版本?那太酷了.

谢谢,


but that is not what i am after.
Is what is it possable?

on this computer i do not have VS 2010 installed, is there like a cloud version of VS 2010 or 2008? that would be cool.

Thanks

推荐答案

不幸的是,我不相信你可以.除非您制作了另一个不可见的表单或模块,然后仅使用form2.(变量名)= what and what = form2.(变量名).或module1.(变量名)=随便什么= module1.(变量名)
在表格2中.只需声明一个公共变量.这将为表格2设置变量并使用它.
公共变量:

Unfortunately, I don''t believe that you can. Unless if you made a second form or module that isn''t ever visible and then just use form2.(variable name) = whatever and whatever = form2.(variable name). OR module1.(variable name) = whatever and whatever = module1.(variable name)
In form 2. Just declare a public variable. This would set the variable for form 2 and use it.
Public variable:

public variablename as integer


这篇关于变量来控制整个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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