VB 2010 - A variable with a value of a label name

前端 未结 5 1443
北荒
北荒 2021-01-22 13:18

I\'m using VB 2010 Express and have a label named \"lblTitle\" in my form. The next code doesn\'t work and I know it , but how can I do something like this?

Dim          


        
5条回答
  •  被撕碎了的回忆
    2021-01-22 14:07

    You can do this assuming you are using windows forms:

    DirectCast(Me.Controls.Find("lblTitle", True)(0), Label).Text = "Hello world"
    

提交回复
热议问题