Buttons to be renamed by the user

允我心安 提交于 2019-12-02 02:50:35

It sounds like you just want a person to click on a button and change the text of that button?

If that is correct, something like this would work in your click method:

With DirectCast(sender, Button)
  .Text = InputBox("Button Name", "Button Name", .Text)
End With

If every button needs that same input, then try something like this:

Dim value As String = InputBox("Button Name", "Button Name")
For Each btn As Button In Buttons
  If btn IsNot Nothing Then
    btn.Text = value
  End If
Next

You should strongly consider moving away from using that Buttons array. If you need to hold a reference of those buttons in a list, use a List(of Button) instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!