可在form_load里边添加,如下:
'初始化
ListView1.FullRowSelect = True '(允许整行选择)
listview1.gridlines=true '(显示网格)
listview1.checkboxs=true '显示checkboxs框
listview1.view=3 '以报表形式显示
ListView1.ColumnHeaders.Clear
ListView1.ColumnHeaders.Add 1, , "姓名", 1000
ListView1.ColumnHeaders.Add 2, , "性别", 500
ListView1.ColumnHeaders.Add 3, , "职称", 1500
ListView1.ColumnHeaders.Add 4, , "电话", 1000
第二步,添加数据
Dim itmX As ListItem
Set itmX = lvw.ListItems.Add(参数,参数,参数,……) '这些参数都可以为空,具体你可以看看msdn
itmX.text="李四"
itmX.SubItems(1) = "雄性"
itmX.SubItems(2) = "大将军"
itmX.SubItems(3) = "10086"
第三步,取得行数据
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Text1 = Item.Text
Text2 = Item.SubItems(1)
Text3 = Item.SubItems(2)
Text4 = Item.SubItems(3)
End Sub
试一试就能知道怎么用了,快去试试吧
先创建一个帮助类BaseHelper,继承SQLiteOpenHelper,然后在获得读取的权限,BaseHelper.getReadableDatabase()查询:Cursor cursor = db.query(TABLE_NAME,str,null,null,null,null,null),接着放到adapter里面然后就显示出来SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.showcontact, cursor, FROM, TO)setListAdapter(adapter)。大概流程就这样,具体看帮助文档或者百度+google
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)