取消引用 [英] Dereferencing

查看:66
本文介绍了取消引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如何处理vb.Net 2003中的解除引用。


类似于:

Dim txt As TextBox = DirectCast(" txt"& someStringVariable,TextBox)


这很遗憾,因为一种字符串无法转换为文本框。

txt + someStringVariable连接将代表表单上文本框的有效名称。


感谢您的任何想法,


Michael

Hi,

How would I handle Dereferencing in vb.Net 2003.

Something like:
Dim txt As TextBox = DirectCast("txt" & someStringVariable, TextBox)

This sadly won''t work because a type of string cannot be casted to a textbox.
The "txt" + someStringVariable concatenation would represent a valid name of a textbox on the form.

Thanks for any ideas,

Michael

推荐答案

*" Michael Maes" < MI ***** @ merlot.com> scripsit:
* "Michael Maes" <mi*****@merlot.com> scripsit:
我如何处理vb.Net 2003中的解除引用。

类似于:

Dim txt As TextBox = DirectCast(" txt" ;& someStringVariable,TextBox)
How would I handle Dereferencing in vb.Net 2003.

Something like:

Dim txt As TextBox = DirectCast("txt" & someStringVariable, TextBox)




存储(名称,控制)对''Hashtable''。


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



Store (name, control) pairs in a ''Hashtable''.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


您是否尝试从字符串变量创建文本框控件作为名称?我不太明白你想做什么,但是要学习解除引用是什么。


-CJ

" Michael Maes" < MI ***** @ merlot.com>在留言新闻中写道:e8 ************** @ TK2MSFTNGP10.phx.gbl ...




我如何处理vb.Net 2003中的解除引用。


类似于:

Dim txt As TextBox = DirectCast(" txt"& someStringVariable, TextBox)


这很遗憾,因为一种字符串无法输入到文本框中。

txt + someStringVariable连接将代表表单上文本框的有效名称。


感谢您的任何想法,


Michael
Are you trying to create a textbox control from a string variable as the name? I don''t quite understand what your trying to do, but would be curiuos to learn what dereferencing is.

-CJ
"Michael Maes" <mi*****@merlot.com> wrote in message news:e8**************@TK2MSFTNGP10.phx.gbl...
Hi,

How would I handle Dereferencing in vb.Net 2003.

Something like:
Dim txt As TextBox = DirectCast("txt" & someStringVariable, TextBox)

This sadly won''t work because a type of string cannot be casted to a textbox.
The "txt" + someStringVariable concatenation would represent a valid name of a textbox on the form.

Thanks for any ideas,

Michael


谢谢,


这是''解决方法''但它会完成这项工作。

必须我得出结论,在VB中这是不可能的?


Michael


" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

新闻:uy ************** @ TK2MSFTNGP09.phx.gbl ...

| *Michael Maes < MI ***** @ merlot.com> scripsit:

| >我将如何处理vb.Net 2003中的解除引用。

| >

| >类似的东西:

| >

| > Dim txt As TextBox = DirectCast(" txt"& someStringVariable,TextBox)

|

|将商店(名称,控件)对存储在''Hashtable'中。

|

| -

| Herfried K. Wagner [MVP]

| < http://www.mvps.org/dotnet>
Thanks,

It''s a ''workaround'' but it will do the job.
Must I conclude that in VB this is not possible?

Michael

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
| * "Michael Maes" <mi*****@merlot.com> scripsit:
| > How would I handle Dereferencing in vb.Net 2003.
| >
| > Something like:
| >
| > Dim txt As TextBox = DirectCast("txt" & someStringVariable, TextBox)
|
| Store (name, control) pairs in a ''Hashtable''.
|
| --
| Herfried K. Wagner [MVP]
| <http://www.mvps.org/dotnet>


这篇关于取消引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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