控制动态创建的标签页 - Vb.net [英] Control on Dynamically created Tab Pages - Vb.net

查看:77
本文介绍了控制动态创建的标签页 - Vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TabControl1.SelectedTab.Controls(4).Text =Test



如何在没有控制号的情况下使用此控件。 ?

(是否可以使用控制名称处理)

TabControl1.SelectedTab.Controls(4).Text ="Test"

How to do with this control without control Number. ?
(Is any way to handle with Control Name)

推荐答案

dim tp as Control = TabControl1.SelectedTab.Controls(4)
tp.Text = "test"


好的,假设您正在选项卡控件中的tabPage上查找按钮控件。这就是你要做的:



Ok, let's say you are looking for a button control on a tabPage in your tab control. This is how you would do it:

Dim theControlYourLookingFor As Button

For Each ctrl As Control In TabControl1.SelectedTab.Controls
    If TypeOf(ctrl) is Button Then
        theControlYourLookingFor = CType(ctrl, Button)
        If theControlYourLookingFor.Name = "yourbutton" then
            ' your code here
        End If
    End If
Next





- Pete



- Pete


这篇关于控制动态创建的标签页 - Vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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