473,836 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1914
* "Joe Fallon" <jf******@nospa mtwcny.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.c om/groups?selm=erq ckvkiopu68885ne k3i60674c1un04b l%404ax.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******@nospa mtwcny.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******@nospa mtwcny.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.h tm>

--
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******@nospa mtwcny.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**********@BT Internet.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_Colum nClick(ByVal sender As Object, ByVal
e As System.Windows. Forms.ColumnCli ckEventArgs)

'remove sort icon from old column.

If SortColumn <> -1 Then

lv.Columns.Item (SortColumn).Te xt =
lv.Columns.Item (SortColumn).Te xt.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).Te xt &= " " & ChrW(&H25B2)

Else

If mSortDirection = "ASC" Then

mSortDirection = "DESC"

'do the sort

'add down icon

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

Else

mSortDirection = "ASC"

'do the sort

'add up icon

lv.Columns.Item (SortColumn).Te xt &= " " & 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******@nospa mtwcny.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.h tm>

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

Nov 20 '05 #6
* "Joe Fallon" <jf******@nospa mtwcny.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
1640
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 LargeIcon view style, and so far I've been unable to get the images to display. The text (captions) don't seem to be a problem. My only guess is that the ImageList isn't "really" being set to the ListView, although it does add space for the images....
6
2543
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; using System.ComponentModel; using System.Windows.Forms; using System.Data;
4
319
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 I allready got on my other newbee questions. You guys must have a lot of petians with me. Thx a lot
1
1441
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 to, so when I change something in that listview all listviews who points to that listview must be updated.. But I don't have a idea why it isn't working.. I tried to make a singeton listview class and get a instance on the form
3
2294
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. e.g. assign population to column2. In vb 6, I can do it by "subitems(i). How about in .net? thx. i = 0 While MyDataAdapter.Read ListView1.Items.Add("") ListView1.Items(i).Text = CStr(MyDataAdapter("name"))...
1
2863
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 objects stored in a List<T> collection. The items in this collection are generated from a user filled out form. The items in the listview have the same index as the ones in List<T>, so I
3
2720
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 there will come errors. How do I fix this problem? Thanks for help.
5
2379
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 fullrowselect=true in the listview Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, _
0
216
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 according to the contents of the cell in which they are clicking and to restore the data to the original view that was provided. So for example if they right clicked on a cell that said "Green Bay Beats Seattle" only rows in the listview that have the
1
848
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
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9656
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10526
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10567
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9349
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5641
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3100
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.