473,385 Members | 1,341 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,385 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 1883
* "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
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...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.