By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

Listview

P: 56
Greetings,

I would like to know how to get values from a listview with it having 5 columns. And How to insert values unto it. It's so much different than listbox. I've been doing a lot of searching but alas, no luck on finding what i am looking for. Thanks in advance.
May 31 '08 #1
Share this Question
Share on Google+
5 Replies


lotus18
100+
P: 866
Greetings,

I would like to know how to get values from a listview with it having 5 columns. And How to insert values unto it. It's so much different than listbox. I've been doing a lot of searching but alas, no luck on finding what i am looking for. Thanks in advance.
For getting values, you can try the SelectedItem. For inserting, ListItems.Add method will do. BTW, What version of vb are you using?

Rey Sean
May 31 '08 #2

Expert 100+
P: 487
This link will give all about Listview
ListView Control for Visual Basic 6.0 Users
May 31 '08 #3

P: 56
I'm using visual basic 6.0.


Can anybody give me a brief explanation on how to manipulate or use the listview effectively?

@Poster above me:
I've seen that page before, still i can't get what i want to achieve. Help please.
Jun 1 '08 #4

lotus18
100+
P: 866
I'm using visual basic 6.0.


Can anybody give me a brief explanation on how to manipulate or use the listview effectively?

@Poster above me:
I've seen that page before, still i can't get what i want to achieve. Help please.
Are you using a database? I can give you a sample code in populating items on a listview

Expand|Select|Wrap|Line Numbers
  1. SetConnection 'My Main Connection
  2.  
  3.     rs.Open "Select * From <TableName>", con, 3, 3
  4.     Listview1.ListItems.Clear
  5.     While Not rs.EOF
  6.         On Error Resume Next 'Ignores null items
  7.         With Listview1.ListItems.Add(, , rs!<PrimaryKey>, 1, 1)
  8.             .SubItems(1) = rs!<Field1>
  9.             .SubItems(2) = rs!<Field2>
  10.             .SubItems(3) = rs!<Field3>
  11.             .SubItems(4) = rs!<Field4>
  12.         End With
  13.         rs.MoveNext
  14.     Wend
Rey Sean
Jun 1 '08 #5

debasisdas
Expert 5K+
P: 8,127
Please find some related articles here and here.
Jun 2 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.