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

前端 未结 5 1449
北荒
北荒 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 13:58

    Try this:

    Dim myLabel As Label = DirectCast(Page.FindControl("lblTitle"), Label)
    myLabel.Text = "some new value"
    

提交回复
热议问题