這篇文章主要介紹了VB.NET中ListView控件怎么用,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)是專業(yè)的益陽網(wǎng)站建設(shè)公司,益陽接單;提供成都網(wǎng)站制作、成都網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行益陽網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
VB.NET ListView控件在程序開發(fā)過程中的使用是非常廣泛的。因?yàn)槠洳恢С謹(jǐn)?shù)據(jù)庫的綁定,所以在數(shù)據(jù)庫程序開發(fā)領(lǐng)域無法與datagridview抗衡,但是ListView的確是一個(gè)非常好用的控件。下面就把一個(gè)簡(jiǎn)單的VB.NET ListView控件的例子發(fā)出來。
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控件裝載數(shù)據(jù)
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
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“VB.NET中ListView控件怎么用”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!