十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要介绍了VB.NET中ListView控件怎么用,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
创新互联是专业的益阳网站建设公司,益阳接单;提供成都网站制作、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行益阳网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
VB.NET ListView控件在程序开发过程中的使用是非常广泛的。因为其不支持数据库的绑定,所以在数据库程序开发领域无法与datagridview抗衡,但是ListView的确是一个非常好用的控件。下面就把一个简单的VB.NET ListView控件的例子发出来。
Public Class heroClass hero Private s_name As String Private s_age As Long Private s_like As String Public Property myName()Property myName() As String Get Return s_name End Get Set(ByVal value As String) s_name = value End Set End Property Public Property myAge()Property myAge() As Long Get Return s_age End Get Set(ByVal value As Long) s_age = value End Set End Property Public Property myLike()Property myLike() As String Get Return s_like End Get Set(ByVal value As String) s_like = value End Set End Property End Class
VB.NET ListView控件装载数据
Private Sub btnLoad_Click()Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click s_flag = True Me.lv1.CheckBoxes = True Dim i As Integer Const maxCount As Long = 10 Dim iItem As ListViewItem Dim aHero As hero For i = maxNumber To maxNumber + maxCount - 1 Dim rd As New System.Random(Environment.TickCount * i) aHero = New her iItem = New ListViewItem aHero.myName = firstName & i.ToString aHero.myAge = System.Math.Round(rd.NextDouble * 100, 0) aHero.myLike = createLike(i) iItem.Text = aHero.myName iItem.Tag = aHero iItem.SubItems.Add(aHero.myAge) iItem.SubItems.Add(aHero.myLike) Me.lv1.Items.Add(iItem) heroList.Add(aHero.myName, aHero) Next maxNumber = i If Me.lv1.Items.Count > 0 Then Me.lv1.Items.Item(0).Checked = True End If s_flag = False End Sub
感谢你能够认真阅读完这篇文章,希望小编分享的“VB.NET中ListView控件怎么用”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!