473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Listview add items?

Dear friends

Items is added like this

Dim itmx As New ListViewItem

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

itmx.SubItems.Add("1")

itmx.SubItems.Add("2")

itmx.SubItems.Add("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 43808
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).Text = "3"
i.SubItems(2).Text = "2"
i.SubItems(1).Text = "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.AddRange(New String() {c, b, a})
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Able" <ab**@epost.no> 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.Add("1")

itmx.SubItems.Add("2")

itmx.SubItems.Add("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.please.leadit.be> skrev i melding
news:%2****************@TK2MSFTNGP12.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).Text = "3"
i.SubItems(2).Text = "2"
i.SubItems(1).Text = "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.AddRange(New String() {c, b, a})
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Able" <ab**@epost.no> 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.Add("1")

itmx.SubItems.Add("2")

itmx.SubItems.Add("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.no> scripsit:
Items is added like this

Dim itmx As New ListViewItem

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

itmx.SubItems.Add("1")

itmx.SubItems.Add("2")

itmx.SubItems.Add("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.no> scripsit:
Items is added like this

Dim itmx As New ListViewItem

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

itmx.SubItems.Add("1")

itmx.SubItems.Add("2")

itmx.SubItems.Add("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.no> scripsit:
Not a single item on Google refering to the insert method.

Please give an example.


Really crippled code:

\\\
With Me.ListView1.Items(0).SubItems
.Add("aa")
.Add("bb")
.Insert(2, New ListViewItem.ListViewSubItem(Nothing, "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
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...
3
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...
0
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...
6
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...
3
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...
12
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. ...
3
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
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...
2
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...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.