473,508 Members | 2,373 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.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 43825
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
1846
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
17022
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
2544
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
3385
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
5191
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
3377
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
7631
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
1876
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
6795
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
8331
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
7321
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
7377
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...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
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,...
1
5047
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...
0
4705
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
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 ...
0
414
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...

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.