我已经以编程方式创建了按钮,并且它们具有文本值但由于某些原因无法显示。
Dim NodeButton As New Control
NodeButton.Name = "Button" & NodeID
NodeButton.BackColor = Color.Red
NodeButton.Text = (NodeID)
NodeID
是程序中其他地方声明的变量
答案 0 :(得分:1)
First, as already said in the comments you should change Dim NodeButton As New Control
to Dim NodeButton As New Button
In second place I believe that you should add the new control to your form using something like this:
Me.Controls.Add(NodeButton)