永发信息网

求vb源代码解释

答案:1  悬赏:70  手机版
解决时间 2021-07-20 23:11

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call addsub()
End Sub
Dim listbox1 As New ListBox() 'new listbox()在这里是什么意思?()表示的有时什么
Dim textbox1 As New TextBox()
Dim labell As New Label()
Dim button1 As New Button()
Dim button2 As New Button()
Dim button3 As New Button()
Dim button4 As New Button()
Dim button5 As New Button()
Dim button6 As New Button()
Private Sub addsub()
listbox1.Size = New System.Drawing.Size(200, 200) '为什么不可以是listbox1.size=(200,200) new在这里是什么意思?
listbox1.Location = New System.Drawing.Point(10, 30)
Me.Controls.Add(listbox1)

listbox1.MultiColumn = True
listbox1.ColumnWidth = 80
listbox1.SelectionMode = SelectionMode.MultiExtended
listbox1.BeginUpdate()
Dim x As Integer
For x = 1 To 50
listbox1.Items.Add("items " & x.ToString()) 'x.tostring是什么意思
Next x 'next x 又是什么意思?
listbox1.EndUpdate()
'创建和添加一个textbox空间并设置其属性
textbox1.Size = New.D Systemrawing.Size(200, 20)
textbox1.Location = New System.Drawing.Point(10, 240)
Me.Controls.Add(textbox1)
textbox1.Multiline = False
textbox1.Text = ""
'创建和添加一个label空间,并设置其属性
labell.Size = New System.Drawing.Size(200, 20)
labell.Location = New System.Drawing.Point(10, 5)
Me.Controls.Add(labell)
labell.Text = ""
button1.Size = New System.Drawing.Size(60, 30)
button1.Location = New System.Drawing.Point(220, 20)
button2.Size = New System.Drawing.Size(60, 30)
button2.Location = New System.Drawing.Point(220, 60)
button3.Size = New System.Drawing.Size(60, 30)
button3.Location = New System.Drawing.Point(220, 100)
button4.Size = New System.Drawing.Size(60, 30)
button4.Location = New System.Drawing.Point(220, 140)
button5.Size = New System.Drawing.Size(60, 30)
button5.Location = New System.Drawing.Point(220, 180)
button6.Size = New System.Drawing.Size(60, 30)
button6.Location = New System.Drawing.Point(220, 220)
Me.Controls.Add(button1)
Me.Controls.Add(button2)
Me.Controls.Add(button3)
Me.Controls.Add(button4)
Me.Controls.Add(button5)
Me.Controls.Add(button6)
button1.Text = "排序"
button2.Text = "删除"
button3.Text = "插入"
button4.Text = "添加"
button5.Text = "查找"
button6.Text = "重做"
AddHandler button1.Click, New System.EventHandler(AddressOf Me.button1_click)
AddHandler button2.Click, New System.EventHandler(AddressOf Me.button2_click)
AddHandler button3.Click, New System.EventHandler(AddressOf Me.button3_click)
AddHandler button4.Click, New System.EventHandler(AddressOf Me.button4_click)
AddHandler button5.Click, New System.EventHandler(AddressOf Me.button5_click)
AddHandler button6.Click, New System.EventHandler(AddressOf Me.button6_click)
End Sub
Private Sub button1_click(ByVal sender As Object, ByVal e As System.EventArgs)
listbox1.Sorted = True
End Sub
Private Sub button2_click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim i As Integer
i = listbox1.SelectedItems.Count
Do While i <> 0
labell.Text = listbox1.SelectedIndex
listbox1.Items.Remove(listbox1.SelectedItem)
i = i - 1
Loop
End Sub
Private Sub button3_click(ByVal sender As Object, ByVal e As System.EventArgs)
listbox1.Items.Insert(listbox1.SelectedIndex, textbox1.Text)
End Sub
Private Sub button4_click(ByVal sender As Object, ByVal e As System.EventArgs)
listbox1.Items.Add(textbox1.Text)
End Sub
Private Sub button5_click(ByVal sender As Object, ByVal e As System.EventArgs)
listbox1.FindString(textbox1.Text)
labell.Text = listbox1.FindString(textbox1.Text)

End Sub
Private Sub button6_click(ByVal sender As Object, ByVal e As System.EventArgs)
textbox1.Clear()
labell.Text = ""

End Sub

End Class

1、Dim listbox1 As New ListBox()

new listbox()在这里是什么意思?()表示的又是什么

2、Call addsub()又是什么意思?

3、Me.Controls.Add(button1)
和 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

End Sub

又有什么区别?功能应该是一样的吧?

4、AddHandler button1.Click, New System.EventHandler(AddressOf Me.button1_click)

是什么意思?

最佳答案

Dim listbox1 As New ListBox() 表示在窗体上创建一个listbox控件,而不是你在编写时加的,是代码加的.......


call 是函数调用说明 addsub()是个定义函数......


.........


都不是那难...

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
強車位是多買幾輛車一塊賺錢好,還是兩三輛以
用ICQ发短消息到国外,然后国外回到ICQ上,资费
如何才能忘了过去
我在藏宝阁出售要洗比要收取多少钱手续费?
今天开的超级QQ好久到期嘛 ?
谁可以送我个爱墙种子,帮忙!
从深圳上沙到深圳第二人民医院坐什么车? site
不需要下载直接在web中打开word文档的方法
农场里的陌生人怎么删除?
http://ctvv11.cn/
表现主义诗歌代表人物,宋朝的代表诗句有哪些
快快帮帮忙!恢复字。
冬天下雪可以吃吗
我喜欢一个男孩子,不知道他喜不喜欢我,我应
直接点QQ相册图标在QQ最近访客里会显示嘛?
推荐资讯
吉林市哪卖路游器
谁有海子的诗集(二手书,可以很冷门的)出售
洛奇创了精灵买人类卡 能不能免费创巨人
泡泡堂运行后没反应
彼此错过之后,距离,生活条件…等因素给莪带
朱元璋有几个儿女啊!
怎么在图片上加图片,Word图片上添加文字,如
八个字的唯美古风诗句,一些唯美古风句子 霸气
求一个ipod touch 的视频转换器
天龙八部 蓝屏 在帮里的时候
桂林北到成都火车K651次正点到是多久?
请问什么我玩游戏的时候显卡温度那么高?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?