控制阵列直播 [英] control arrays directcast

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

问题描述

http://uploadpic.org/storage/2011/bEJhbXzf8ijl3jY0wipzFkQn5.png [ ^ ]



上面是在运行时创建的控件数组但是如何在取消选中时使用该复选框,它将禁用左侧的文本框,因为我为checkbox()数组和textbox()数组创建了相同的索引。

usualy我正在使用直接投射,所以我可以动态指向我需要的控件但在这里我不能指向控制内部控制数组以下

http://uploadpic.org/storage/2011/bEJhbXzf8ijl3jY0wipzFkQn5.png[^]

above is control arrays created in runtime but how can i make the user when unchecked the checkbox it will disable the text box in left hand side considering that i made the same index for checkbox() array and textbox() array.
usualy i was using direct cast so i can dynamically point to the control i need but here i can''t point to control inside control array with the below

Dim c As TextBox = DirectCast(Controls("textbox(5)"), TextBox)





FYI:我想使用直接演员因为我有很多标签,每个都有复选框和文本框,所以使用直接转换和识别发件人容器(组面板)我可以定义复选框的位置并且需要禁用部分。



另一个问题:

当我添加一个处理程序来控制数组时,名称属性总是和其他属性具有正确的值。



FYI: i want to use direct cast because i have a lot of tabs and each has check box and text boxes so using direct cast and by identifying the sender container (group panel) i can defined the location of check box and the needed part to be disabled.

another question:
when i add a handler to control array always the name properties is "" and other properties have correct values.

推荐答案

执行如下代码,

do code like below,
Dim Container As Panel = DirectCast(sender.parent,Panel ) 
if block= "Motor" then
      Dim tag As TextBox = DirectCast(Container.Controls.find(MotorTag(index),true).GetValue(0), TextBox)
else if block= "valve" then
     Dim tag As TextBox = DirectCast(Container.Controls.find(ValveTag(index),true).GetValue(0), TextBox)
end if 



Happy Coding!

:)


Happy Coding!
:)


这篇关于控制阵列直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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