Home » VB.NetRSS

VB.NET Express 2008 can't change ForeColor of ListViewSubItem

Why can't VB.NET Express 2008 change the ForeColor of ListViewSubItem?  I see posts on the internet setting oListViewSubItem.UseItemStyleForSubItems = False but VB.NET Express 2008 does not have this property. 

 

6 Answers Found

 

Answer 1

Express, Enterprise.  The compiler is the same.  Which ListView are you using?
 

Answer 2

Did you try the example here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.useitemstyleforsubitems.aspx

The properties and methods of the Framework classes are determined by the version of the framework you are using, not the version of VS.  That property should be available to you in VB .Net 2008 Express.  Are yo sure that the oListViewSubItem object really is a ListViewItem?

 

Answer 3

Thanks for the reply John.

I'm using the one in the Toolbox under "All Windows Forms".  The Solution Explorer describes it as System.Windows.Forms.ListView.

According to the project's References System.Windows.Forms is .NET 2.0.0.0

 

 

Answer 4

I'm using the one in the Toolbox under "All Windows Forms".  The Solution Explorer describes it as System.Windows.Forms.ListView.  According to the project's References System.Windows.Forms is .NET 2.0.0.0  Your link state that UseItemStyleForSubItems is support in 4, 3.5, 3.0, 2.0, 1.1, 1.0.  If it's supported in 2.0 then why can't I see the property?

I don't know what this means but it also says ".NET Framework client Compile: supported in: 4, 3.5 SP1".

Yes it is a ListViewItem object:  Dim oListViewItem As ListViewItem

OS: Windows XP SP2 x64 (which is supported accoring to your link)

 

Answer 5

The code you posted in your original post is incorrect.  It should be something like:

    ListView1.Items(0).UseItemStyleForSubItems = True

or

    Dim ListViewItem As New ListViewItem
    ListViewItem.UseItemStyleForSubItems = 
True

 

Answer 6

John, I tried your code:

Dim ListViewItem As New ListViewItem
    ListViewItem.UseItemStyleForSubItems = 
True


Although, ListViewItem is not associated to my listview control (how do you associate it to a listview control?) but the UseItemStyleForSubItems property is property member.  So, I went back and check my oListViewItem and UseItemStyleForSubItems property is property member.  I swear it wasn't there before. 

oListViewItem = ListView1.Items.Add(sItemOrDocumentName)

UseItemStyleForSubItems = 

True didn't work but False did work.

Thanks again for the help John.

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter