473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listview add items?

Dear friends

Items is added like this

Dim itmx As New ListViewItem

itmx = ListView1.Items .Add("Title", 0)

itmx.SubItems.A dd("1")

itmx.SubItems.A dd("2")

itmx.SubItems.A dd("3")

The item "2" is added in row one in second column and "3" is added in row
one in third column. But is it possible to add item "2" in row one in third
column and add "3" in row one in second column without rearranging the
sequence in designtime. In other words is it possibly to programaticly
determine the column?

Regards Able
Nov 20 '05 #1
5 43850
There are some possibilities:

'Create empty subitems and fill them
Dim i As ListViewItem = ListView1.Items .Add("Test")
i.SubItems.Add( String.Empty)
i.SubItems.Add( String.Empty)
i.SubItems.Add( String.Empty)
i.SubItems(3).T ext = "3"
i.SubItems(2).T ext = "2"
i.SubItems(1).T ext = "1"

'Use temp. variables
Dim j As ListViewItem = ListView1.Items .Add("Test")
Dim a, b, c As String
a = "1"
b = "2"
c = "3"
j.SubItems.AddR ange(New String() {c, b, a})
--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan
"Able" <ab**@epost.n o> schreef in bericht
news:xH******** *********@news4 .e.nsc.no...
Dear friends

Items is added like this

Dim itmx As New ListViewItem

itmx = ListView1.Items .Add("Title", 0)

itmx.SubItems.A dd("1")

itmx.SubItems.A dd("2")

itmx.SubItems.A dd("3")

The item "2" is added in row one in second column and "3" is added in row
one in third column. But is it possible to add item "2" in row one in third column and add "3" in row one in second column without rearranging the
sequence in designtime. In other words is it possibly to programaticly
determine the column?

Regards Able

Nov 20 '05 #2
Superb.

Able
"Jan Tielens" <ja*@no.spam.pl ease.leadit.be> skrev i melding
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
There are some possibilities:

'Create empty subitems and fill them
Dim i As ListViewItem = ListView1.Items .Add("Test")
i.SubItems.Add( String.Empty)
i.SubItems.Add( String.Empty)
i.SubItems.Add( String.Empty)
i.SubItems(3).T ext = "3"
i.SubItems(2).T ext = "2"
i.SubItems(1).T ext = "1"

'Use temp. variables
Dim j As ListViewItem = ListView1.Items .Add("Test")
Dim a, b, c As String
a = "1"
b = "2"
c = "3"
j.SubItems.AddR ange(New String() {c, b, a})
--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan
"Able" <ab**@epost.n o> schreef in bericht
news:xH******** *********@news4 .e.nsc.no...
Dear friends

Items is added like this

Dim itmx As New ListViewItem

itmx = ListView1.Items .Add("Title", 0)

itmx.SubItems.A dd("1")

itmx.SubItems.A dd("2")

itmx.SubItems.A dd("3")

The item "2" is added in row one in second column and "3" is added in row one in third column. But is it possible to add item "2" in row one in

third
column and add "3" in row one in second column without rearranging the
sequence in designtime. In other words is it possibly to programaticly
determine the column?

Regards Able


Nov 20 '05 #3
* "Able" <ab**@epost.n o> scripsit:
Items is added like this

Dim itmx As New ListViewItem

itmx = ListView1.Items .Add("Title", 0)

itmx.SubItems.A dd("1")

itmx.SubItems.A dd("2")

itmx.SubItems.A dd("3")

The item "2" is added in row one in second column and "3" is added in row
one in third column. But is it possible to add item "2" in row one in third
column and add "3" in row one in second column without rearranging the
sequence in designtime. In other words is it possibly to programaticly
determine the column?


Just asking: Why? You may want to have a look at the 'Insert' method
instead of using 'Add' (untested).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Not a single item on Google refering to the insert method.

Please give an example.

Regards Able

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> skrev i melding
news:bu******** ****@ID-208219.news.uni-berlin.de...
* "Able" <ab**@epost.n o> scripsit:
Items is added like this

Dim itmx As New ListViewItem

itmx = ListView1.Items .Add("Title", 0)

itmx.SubItems.A dd("1")

itmx.SubItems.A dd("2")

itmx.SubItems.A dd("3")

The item "2" is added in row one in second column and "3" is added in row one in third column. But is it possible to add item "2" in row one in third column and add "3" in row one in second column without rearranging the
sequence in designtime. In other words is it possibly to programaticly
determine the column?


Just asking: Why? You may want to have a look at the 'Insert' method
instead of using 'Add' (untested).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
* "Able" <ab**@epost.n o> scripsit:
Not a single item on Google refering to the insert method.

Please give an example.


Really crippled code:

\\\
With Me.ListView1.It ems(0).SubItems
.Add("aa")
.Add("bb")
.Insert(2, New ListViewItem.Li stViewSubItem(N othing, "bb"))
End With
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1850
by: Islam Elkhayat | last post by:
In my Application i search my Employee database and view result in List View with 3 column.. here is the code: ######################################### private void textBox1_TextChanged(object sender, System.EventArgs e) { this.listView1.Items.Clear();
3
17040
by: Dave Rich | last post by:
Hi I am trying to access the listview items from a SysListView32 control in C#. I am using LVM.FINDITEM and LVFINDINFO through SendMessage to try to get the text from each column in the item (it is a multi-column list view). I am using the PARTIAL flag to try to find an item starting with a certain letter, that i am setting on the...
0
2548
by: Samuel R. Neff | last post by:
I'm having a index problem with ListView SubItems. If I add multiple columns to the listview and then add items with associated subitems, the ListView displays fine. Then if I delete a column via ListView.Columns.RemoveAt() then the ListView still displays fine. However, if I grab a subitem value via listView.Items.SubItems.Text Then I...
6
3388
by: Nick | last post by:
Hi there, I'm trying to implement drag-drop for my listview control in large icon view mode. Unfortunately the order of the items gets completely messed up upon inserting the item back into the listview, removing the item obviously keeps everything fine but the second I use insert the item is added to the *end* of the listview. Does...
3
5195
by: Eduard | last post by:
Hey, I'm looking for a listview which is able to group listview items like Outlook 2003 does. Collapsable and expandable. Does anybody know one (or a site to download good controls from)? I couldn't find one at CodeProject.com site (which is my favorite) Thnx! Eduard
12
3386
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. Very simple. I would like to create listviewitem's for display in a listview control. The listview items need to contain properties from Internet...
3
7637
by: RT | last post by:
Is there any way to make Listview items invisible or otherwise keep them from displaying? Seems like temporarily removing, then restoring later would be a severe runtime hit.
0
1882
by: Peter | last post by:
Hi, I have a problem with Listview using checkboxes. If i check items by code BEFORE the form is shown the Listview.Items are confused during the ItemChecked Event !!! After showing the form every thing works fine: checking items by code as well as checking with mouse: Using the CheckdItems Property is confused too.
2
6816
by: Peter | last post by:
Hi, I have a problem with Listview using checkboxes. If i check items by code BEFORE the form is shown the Listview.Items are confused during the ItemChecked Event !!! After showing the form every thing works fine: checking items by code
1
8338
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, In my application I need to periodically remove all current items from a ListView and add a new set into it. The following abbreviated code contains the basic idea: private void FillListViewFromFile(string path) {
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
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...
0
7979
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...
0
6284
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...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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...
0
3653
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...
1
2115
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
0
940
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...

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.