473,813 Members | 3,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Items to Listview Manually.

debasisdas
8,127 Recognized Expert Expert
Select Microsoft windows common controls 6.0 (SP6) from components
Add a ListView control to the form.
Add 2 ImageList controls to the form.
Add some bitmaps to both the imagelist.
Set the name of image list to the Normal and small icon Image List from the Image lists tab in property pallet of the Listview control.
Add a combobox .

Add this sample code to the form
=============== ==============
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_Click()
  2. LV1.View = Combo1.ListIndex
  3. End Sub
  4.  
  5. Private Sub Form_Load()
  6. Dim C As ColumnHeader
  7. Dim i As Integer
  8. For i = 1 To 4
  9. Set C = LV1.ColumnHeaders.Add()
  10. C.Text = "Field" & i
  11. C.Width = LV1.Width / 4
  12. Next i
  13.  
  14. Dim li1 As ListItem
  15. Set li1 = LV1.ListItems.Add()
  16. li1.Text = "Item 1"
  17. li1.Icon = 4
  18. li1.SmallIcon = 1
  19. LV1.ListItems(1).ListSubItems.Add , , "Field2"
  20. LV1.ListItems(1).ListSubItems.Add , , "Field3"
  21. LV1.ListItems(1).ListSubItems.Add , , "Field4"
  22.  
  23. Dim li2 As ListItem
  24. Set li2 = LV1.ListItems.Add()
  25. li2.Text = "Item 2"
  26. li2.Icon = 4
  27. li2.SmallIcon = 1
  28. LV1.ListItems(2).ListSubItems.Add , , "Field2"
  29. LV1.ListItems(2).ListSubItems.Add , , "Field3"
  30. LV1.ListItems(2).ListSubItems.Add , , "Field4"
  31.  
  32. Dim li3 As ListItem
  33. Set li3 = LV1.ListItems.Add()
  34. li3.Text = "Item 3"
  35. li3.Icon = 4
  36. li3.SmallIcon = 1
  37. LV1.ListItems(3).ListSubItems.Add , , "Field2"
  38. LV1.ListItems(3).ListSubItems.Add , , "Field3"
  39. LV1.ListItems(3).ListSubItems.Add , , "Field4"
  40.  
  41. With Combo1
  42. .AddItem "Icon View"
  43. .AddItem "Small Icon View"
  44. .AddItem "List View"
  45. .AddItem "Report View"
  46. End With
  47.  
  48. End Sub
  49.  
  50.  
Oct 18 '07 #1
0 17872

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

Similar topics

1
1672
by: Angelina | last post by:
Hi, I wanted to add a few items to my listview control. The values of these will be obtained from other controls on my interface. When the user clicks the select button, they will need to be added to my listview. This is what i need help doing. I have added the columns to the listview but i now want to add the values that correspond to these columns so that they all appear in a single row.
9
6132
by: Eva | last post by:
Hi, I wanted to know how i can enter values into a specific column of a listview. I have tried the following code but this seems to enter all my values into the first column!!! Can anyone please help me out on this?? hers my code so far.....
2
9043
by: cybertof | last post by:
Hello, Is there a solution to the following problem : When filling a listview (30 columns) with around 5000 items, it can take easily 10 sec for the listview to be filled. I have used BeginUpdate and SuspendLayout but no speed... Here is a flavor of the code :
6
10802
by: Maheshkumar.R | last post by:
How i can store images in array @ runtime..? What are the possbile ways.. Thankz.. - Mähésh Kumär. R
3
2617
by: Holmes | last post by:
Hello Ran into a bit of a problem here and have now exhausted my resources to getting this working What I am trying to do is load and show a simple vb form with a listbox in it Dim frm_nc_code As New frm_nc_sen frm_nc_code.Show( Well what I want to have happen is it loads the form then shows all of the controls on the form (especially the listview control which should be blank at this time)
20
6680
by: Ash Phillips | last post by:
Hi Everyone, I have this program I wrote in VB6 for family use. It's a DVD Database just for me to keep track of them cause I have so many lol. In VB6, I could add items to the ListView in 'frmMain' from 'frmAdd' with the following code: Private Function AddEntry(Title As String, Rating As String, Genre As String, OnLoan As Boolean, ToWho As String)
2
2471
by: dotnetnewbie | last post by:
Whilst looping through items in a listview I wish to have the option of inserting a new row (in the middle not necessarily at the end of the listview). thus if lvw is the listview name dim itm as listviewitem For each itm in lvw.Items 'if certain condition is met then insert new row in the listview here
0
1424
by: Steve K. | last post by:
I understand the concepts and rules for invoking UI methods from a non-UI thread. In the past I have always checked with the control's InvokeRequired property and Invoked my delegate accordingly. This has worked fine, nothing special. BUT, I am now working on my first client/server app and I have a slightly new challenge that I'm not finding a good solution for. My client passes an EventShim with a callback to the server. When...
0
10667
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10139
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9222
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.