473,322 Members | 1,409 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,322 software developers and data experts.

ListView Question

The ListView control is the one used in Windows Explorer Detail view.
When you click a column heading in Windows Explorer to sort the column you
get a little triangle pointing up or down depending on the sort direction.

How do you get the triangle to appear when you click a column heading on a
ListView control in VB.Net?
--
Joe Fallon


Nov 20 '05 #1
6 1879
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
The ListView control is the one used in Windows Explorer Detail view.
When you click a column heading in Windows Explorer to sort the column you
get a little triangle pointing up or down depending on the sort direction.

How do you get the triangle to appear when you click a column heading on a
ListView control in VB.Net?


<http://groups.google.com/groups?selm=erqckvkiopu68885nek3i60674c1un04bl%404 ax.com>

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

I don't speak C++.

I guess you are saying there is no VB.Net way to do this.
--
Joe Fallon
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bq*************@ID-208219.news.uni-berlin.de...
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
The ListView control is the one used in Windows Explorer Detail view.
When you click a column heading in Windows Explorer to sort the column you get a little triangle pointing up or down depending on the sort direction.
How do you get the triangle to appear when you click a column heading on a ListView control in VB.Net?

<http://groups.google.com/groups?selm...74c1un04bl%404
ax.com>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
I don't speak C++.

I guess you are saying there is no VB.Net way to do this.


There is a VB.NET way, by using p/invoke. You will find a VB6 sample
here, sorry, I don't have a .NET implementation:

<http://www.mvps.org/vbnet/code/comctl/lvheaderimage.htm>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
have you ever been convicted ?, if so this would make you a 'Convicted
Fallon' and anything that you write which could be said to be typical of you
would mean that you had commited a 'Fallony'

Sorry , could not resist that :-)

Regards - OHM
Joe Fallon wrote:
LOL!

I don't speak C++.

I guess you are saying there is no VB.Net way to do this.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bq*************@ID-208219.news.uni-berlin.de...
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
The ListView control is the one used in Windows Explorer Detail
view. When you click a column heading in Windows Explorer to sort
the column you get a little triangle pointing up or down depending
on the sort direction.

How do you get the triangle to appear when you click a column
heading on a ListView control in VB.Net?

<http://groups.google.com/groups?selm...74c1un04bl%404 ax.com>

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


Best Regards - OHMBest Regards - OHM On**********@BTInternet.Com
Nov 20 '05 #5
Herfried,
The rest of the thread you pointed me to did include a VB.Net solution from
Jay Harlow.
I just implemented it and it works great.

The trick is to change the column text value when sorting by adding 3 spaces
and the Unicode characters for the small black Up and Down triangles. Strip
them off when changing columns.

Sample code for lurkers:
Protected Overrides Sub dvDisplay_ColumnClick(ByVal sender As Object, ByVal
e As System.Windows.Forms.ColumnClickEventArgs)

'remove sort icon from old column.

If SortColumn <> -1 Then

lv.Columns.Item(SortColumn).Text =
lv.Columns.Item(SortColumn).Text.TrimEnd(Chr(32), Chr(32), Chr(32),
ChrW(&H25B2), ChrW(&H25BC))

End If

If e.Column <> SortColumn Then

SortColumn = e.Column

mSortDirection = "ASC"

'add down icon

lv.Columns.Item(SortColumn).Text &= " " & ChrW(&H25B2)

Else

If mSortDirection = "ASC" Then

mSortDirection = "DESC"

'do the sort

'add down icon

lv.Columns.Item(SortColumn).Text &= " " & ChrW(&H25BC)

Else

mSortDirection = "ASC"

'do the sort

'add up icon

lv.Columns.Item(SortColumn).Text &= " " & ChrW(&H25B2)

End If

End If

End Sub
--
Joe Fallon
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bq*************@ID-208219.news.uni-berlin.de...
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
I don't speak C++.

I guess you are saying there is no VB.Net way to do this.


There is a VB.NET way, by using p/invoke. You will find a VB6 sample
here, sorry, I don't have a .NET implementation:

<http://www.mvps.org/vbnet/code/comctl/lvheaderimage.htm>

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

Nov 20 '05 #6
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
The rest of the thread you pointed me to did include a VB.Net solution from
Jay Harlow.
I just implemented it and it works great.

The trick is to change the column text value when sorting by adding 3 spaces
and the Unicode characters for the small black Up and Down triangles. Strip
them off when changing columns.


ACK, that will work. Nevertheless it doesn't mimic the nice 3D effect
like in explorer.

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

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

Similar topics

1
by: Glenn | last post by:
I'm creating a virtual ListView with C#. I've seen a few code posts stating that a virtual ListView will not work if the View is LargeIcon or SmallIcon. Is this true? My project requires the...
6
by: Vanessa | last post by:
With this program I can do one selection, but upon the second I get an error where ///////////////// is indicated. Please help. using System; using System.Drawing; using System.Collections;...
4
by: Jan | last post by:
How do i get the index of a selected item from a listview, I know how it works for a listbox. But I can't figure it out for a listview? Another newbee question By the way, thx for the answers...
1
by: Derck | last post by:
SORRY, for the crosspost, but I think I posted it in the wrong group! Hello all, I have a question.. I am tying to make a global listview class where other listviews in my application points...
3
by: SA | last post by:
My listview has 3 columns i.e. name, populaiton, and country code in order. I use following code to insert data into listview and I find that I can't assign which subitem related to related field....
1
by: Chris | last post by:
Hi all, I posted the following in microsoft.public.dotnet.framework.windowsforms but it seems that group has little traffic. Hi all, I have a listview box which is populated from methods of...
3
by: Jason Huang | last post by:
Hi, In my C# Windows Form MyForm, it has a ListView ListView1. If I click those ListViewItems in ListView1, it's OK; but if I click empty space in ListView1 rather than those ListViewItems, then...
5
by: Martin Horn | last post by:
Hi all, I want to implement a listview with editable subitems and I assume the easiest way is to overlay a textbox over the item to be edited. With this in mind I have come up with: Using...
0
by: scorpion53061 | last post by:
Hi Folks, Hoping someone has done this before as I am a little bit in a crunch of time. I have a listview in which I have added a context menu that displays the option to Filter Data...
1
by: baldrick | last post by:
I have a listview that I set to view.details with the following code... With Me.ListView .View = View.Details But when I add the declaration Imports ADOX
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.