visual basic array按钮 [英] visual basic array button
本文介绍了visual basic array按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我现在正在研究vb
我现在正在尝试制作一个简单的代码..
通过点击弹出一个hello worldmsgbox在按钮上
i使用数组添加我的表单上的按钮
这里是我的示例代码
hello, i am now researching on vb
i'm now trying to make a simple code..
to pop out a "hello world" msgbox by click on the button
i add the button on my form by using array
here is my sample code
<pre lang="vb">
Dim ButArr As System.Windows.Forms.Button() = New Button(0) {}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ButArr(0) = New Button
ButArr(0).Height = 50
ButArr(0).Width = 100
ButArr(0).Top = 70
ButArr(0).Left = 200
ButArr(0).FlatStyle = FlatStyle.Flat
ButArr(0).ForeColor = Color.WhiteSmoke
ButArr(0).BackColor = Color.DarkViolet
ButArr(0).Text = "Hello World"
Controls.Add(ButArr(0))
End Sub
现在我想知道我应该怎么开始我的命令..
now i m wondering how should i start my command..
推荐答案
nvm我通过添加这个功能找到了解决方案
nvm i found the solution by adding this function
AddHandler ButArr(0).Click, AddressOf ClickHandler
然后< br $> b $ b
and then
Public Sub ClickHandler(ByVal sender As Object, ByVal e As _
System.EventArgs)
MsgBox("Hello World")
End Sub
这篇关于visual basic array按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文