String类型为Object

时间:2015-03-22 06:02:30

标签: .net vb.net

对于一个noob问题感到抱歉,但是不想重复这个问题" MainFrm1.UcSettings"每次都是......

MainFrm1.UcSettings.IDtxt.text = 0112
MainFrm1.UcSettings.Nametxt.text = "Chuck Norris"
and so on...

我想要它做的是设置这样的字符串..

Dim str as string = "MainFrm1.UcSettings"
dim obj as object = str

obj.IDtxt.text = 0112
obj.Nametxt.text = "Chuck Norris"
and so on...

但我所做的是错误的......如何以正确的方式做到这一点? tnx提前..

1 个答案:

答案 0 :(得分:1)

我希望您的UcSettings成为自定义用户控件。然后你可以使用它是一种类型:

Dim uc as UcSettings = MainFrm1.UcSettings

uc.IDtxt.text = 0112
uc.Nametxt.text = "Chuck Norris"