Hello,
I'm creating a control including a listview. I would like to be able to
set the columns through the Design Tool in Visual Studio, so I created a
parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns
{
get
{
return(this.myL istView.Columns );
}
set
{
this.myListView .Columns.Clear( );
foreach(Columns Header column in value)
{
this.myListView .Columns.add(co lumn);
}
}
Of course this is not working, I can insert my columns in the designer,
but when I launch my application, the collection is empty. I'm sure what I
did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent 7 3545
Laurent,
Two things first. One, your property should be public, otherwise, I
don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per
the public naming convention.
That being said, you need to attach the following attributes to your
MyColumns property:
[MergablePropert y(false), Localizable(tru e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content),
Editor("System. Windows.Forms.D esign.ColumnHea derCollectionEd itor,
System.Design, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a", typeof(UITypeEd itor)),
SRDescription(" ListViewColumns Descr")]
This will enable the property window to help with designing your
columns.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message
news:uM******** ******@TK2MSFTN GP06.phx.gbl...
Hello,
I'm creating a control including a listview. I would like to be able to
set the columns through the Design Tool in Visual Studio, so I created a
parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns
{
get
{
return(this.myL istView.Columns );
}
set
{
this.myListView .Columns.Clear( );
foreach(Columns Header column in value)
{
this.myListView .Columns.add(co lumn);
}
}
Of course this is not working, I can insert my columns in the designer,
but when I launch my application, the collection is empty. I'm sure what I
did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Hi Nicholas !
Thanks for your answer. I tried what you said, and Visual Studio returns
me some error... I use Visual Studio 2003, prehaps this is the point.
Anyway, I see my collection on the parameter window of the designer and
when I click on it I have a wizard which helps me to create new columns. As
far as I don't close the designer, I can see my columns on my form painted
on Visual Studio. But when I launch my application or close/reopen the
designer, I have lost all my columns.
I guess the set() part of my parameter is wrong, but I don't know what
to do...
Thanks again ! :)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c oma écrit
dans le message de news: uY************* *@TK2MSFTNGP05. phx.gbl...
Laurent,
Two things first. One, your property should be public, otherwise, I
don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as
per the public naming convention.
That being said, you need to attach the following attributes to your
MyColumns property:
[MergablePropert y(false), Localizable(tru e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content),
Editor("System. Windows.Forms.D esign.ColumnHea derCollectionEd itor,
System.Design, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a", typeof(UITypeEd itor)),
SRDescription(" ListViewColumns Descr")]
This will enable the property window to help with designing your
columns.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message
news:uM******** ******@TK2MSFTN GP06.phx.gbl...
> Hello,
I'm creating a control including a listview. I would like to be able to set the columns through the Design Tool in Visual Studio, so I created a parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns { get { return(this.myL istView.Columns ); } set { this.myListView .Columns.Clear( );
foreach(Columns Header column in value) { this.myListView .Columns.add(co lumn); } }
Of course this is not working, I can insert my columns in the designer, but when I launch my application, the collection is empty. I'm sure what I did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Have you play with this sample: http://msdn2.microsoft.com/en-us/lib...ollection.aspx
chanmm
"Laurent Navarro" <yo*@yop.comwro te in message
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
Hi Nicholas !
Thanks for your answer. I tried what you said, and Visual Studio
returns me some error... I use Visual Studio 2003, prehaps this is the
point.
Anyway, I see my collection on the parameter window of the designer and
when I click on it I have a wizard which helps me to create new columns.
As far as I don't close the designer, I can see my columns on my form
painted on Visual Studio. But when I launch my application or close/reopen
the designer, I have lost all my columns.
I guess the set() part of my parameter is wrong, but I don't know what
to do...
Thanks again ! :)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c oma écrit
dans le message de news: uY************* *@TK2MSFTNGP05. phx.gbl...
>Laurent,
Two things first. One, your property should be public, otherwise, I don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per the public naming convention.
That being said, you need to attach the following attributes to your MyColumns property:
[MergablePropert y(false), Localizable(tru e), DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Content), Editor("System .Windows.Forms. Design.ColumnHe aderCollectionE ditor, System.Desig n, Version=2.0.0.0 , Culture=neutral , PublicKeyToken =b03f5f7f11d50a 3a", typeof(UITypeEd itor)), SRDescription( "ListViewColumn sDescr")]
This will enable the property window to help with designing your columns.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message news:uM******* *******@TK2MSFT NGP06.phx.gbl.. .
>> Hello,
I'm creating a control including a listview. I would like to be able to set the columns through the Design Tool in Visual Studio, so I created a parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns { get { return(this.myL istView.Columns ); } set { this.myListView .Columns.Clear( );
foreach(Columns Header column in value) { this.myListView .Columns.add(co lumn); } }
Of course this is not working, I can insert my columns in the designer, but when I launch my application, the collection is empty. I'm sure what I did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Yep, I saw this sample. I'm sure I can do it by hard coding the names of
my columns, but I would like my control to be fully compatible with the
Visual Studio Designer, ie being able to define the columns using the
wizard...
Thanks anyway ! :)
"chanmm" <ch*****@hotmai l.coma écrit dans le message de news: en************* *@TK2MSFTNGP02. phx.gbl...
Have you play with this sample: http://msdn2.microsoft.com/en-us/lib...ollection.aspx
chanmm
"Laurent Navarro" <yo*@yop.comwro te in message
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
> Hi Nicholas !
Thanks for your answer. I tried what you said, and Visual Studio returns me some error... I use Visual Studio 2003, prehaps this is the point.
Anyway, I see my collection on the parameter window of the designer and when I click on it I have a wizard which helps me to create new columns. As far as I don't close the designer, I can see my columns on my form painted on Visual Studio. But when I launch my application or close/reopen the designer, I have lost all my columns.
I guess the set() part of my parameter is wrong, but I don't know what to do...
Thanks again ! :)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c oma écrit dans le message de news: uY************* *@TK2MSFTNGP05. phx.gbl...
>>Laurent,
Two things first. One, your property should be public, otherwise, I don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per the public naming convention.
That being said, you need to attach the following attributes to your MyColumns property:
[MergablePropert y(false), Localizable(tru e), DesignerSeria lizationVisibil ity(DesignerSer ializationVisib ility.Content), Editor("Syste m.Windows.Forms .Design.ColumnH eaderCollection Editor, System.Design , Version=2.0.0.0 , Culture=neutral , PublicKeyToke n=b03f5f7f11d50 a3a", typeof(UITypeEd itor)), SRDescription ("ListViewColum nsDescr")]
This will enable the property window to help with designing your columns.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message news:uM****** ********@TK2MSF TNGP06.phx.gbl. .. Hello,
I'm creating a control including a listview. I would like to be able to set the columns through the Design Tool in Visual Studio, so I created a parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns { get { return(this.myL istView.Columns ); } set { this.myListView .Columns.Clear( );
foreach(Columns Header column in value) { this.myListView .Columns.add(co lumn); } }
Of course this is not working, I can insert my columns in the designer, but when I launch my application, the collection is empty. I'm sure what I did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Laurent Navarro wrote:
Hello,
I'm creating a control including a listview. I would like to be able to
set the columns through the Design Tool in Visual Studio, so I created a
parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns
{
get
{
return(this.myL istView.Columns );
}
set
{
this.myListView .Columns.Clear( );
foreach(Columns Header column in value)
{
this.myListView .Columns.add(co lumn);
}
}
Of course this is not working, I can insert my columns in the designer,
but when I launch my application, the collection is empty. I'm sure what I
did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Did you try looking at the code that the Designer wrote as a result?
Please post the code that the Designer writes when you insert, say,
three columns into your list view column collection. Once we see that,
we can probably tell you why your collection is empty at run time.
Remove the set() part. You don't need it
I think Nicholas assumed you were using 2.0 (the
ColumnHeaderCol lectionEditor doesn't seem to exist in 1.1). Try with this
[MergablePropert y(false), Localizable(tru e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]
public ListView.Column HeaderCollectio n MyColumns
{
get
{
return(this.myL istView.Columns );
}
}
/claes
"Laurent Navarro" <yo*@yop.comwro te in message
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
Hi Nicholas !
Thanks for your answer. I tried what you said, and Visual Studio
returns me some error... I use Visual Studio 2003, prehaps this is the
point.
Anyway, I see my collection on the parameter window of the designer and
when I click on it I have a wizard which helps me to create new columns.
As far as I don't close the designer, I can see my columns on my form
painted on Visual Studio. But when I launch my application or close/reopen
the designer, I have lost all my columns.
I guess the set() part of my parameter is wrong, but I don't know what
to do...
Thanks again ! :)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c oma écrit
dans le message de news: uY************* *@TK2MSFTNGP05. phx.gbl...
>Laurent,
Two things first. One, your property should be public, otherwise, I don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per the public naming convention.
That being said, you need to attach the following attributes to your MyColumns property:
[MergablePropert y(false), Localizable(tru e), DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Content), Editor("System .Windows.Forms. Design.ColumnHe aderCollectionE ditor, System.Desig n, Version=2.0.0.0 , Culture=neutral , PublicKeyToken =b03f5f7f11d50a 3a", typeof(UITypeEd itor)), SRDescription( "ListViewColumn sDescr")]
This will enable the property window to help with designing your columns.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message news:uM******* *******@TK2MSFT NGP06.phx.gbl.. .
>> Hello,
I'm creating a control including a listview. I would like to be able to set the columns through the Design Tool in Visual Studio, so I created a parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns { get { return(this.myL istView.Columns ); } set { this.myListView .Columns.Clear( );
foreach(Columns Header column in value) { this.myListView .Columns.add(co lumn); } }
Of course this is not working, I can insert my columns in the designer, but when I launch my application, the collection is empty. I'm sure what I did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
Thanks Claes !
It's working, there was no need to create a set() function, as you said
!!!
Thanks a lot
"Claes Bergefall" <lo*****@nospam .nospama écrit dans le message de news: Oq************* *@TK2MSFTNGP04. phx.gbl...
Remove the set() part. You don't need it
I think Nicholas assumed you were using 2.0 (the
ColumnHeaderCol lectionEditor doesn't seem to exist in 1.1). Try with this
[MergablePropert y(false), Localizable(tru e),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]
public ListView.Column HeaderCollectio n MyColumns
{
get
{
return(this.myL istView.Columns );
}
}
/claes
"Laurent Navarro" <yo*@yop.comwro te in message
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
> Hi Nicholas !
Thanks for your answer. I tried what you said, and Visual Studio returns me some error... I use Visual Studio 2003, prehaps this is the point.
Anyway, I see my collection on the parameter window of the designer and when I click on it I have a wizard which helps me to create new columns. As far as I don't close the designer, I can see my columns on my form painted on Visual Studio. But when I launch my application or close/reopen the designer, I have lost all my columns.
I guess the set() part of my parameter is wrong, but I don't know what to do...
Thanks again ! :)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c oma écrit dans le message de news: uY************* *@TK2MSFTNGP05. phx.gbl...
>>Laurent,
Two things first. One, your property should be public, otherwise, I don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per the public naming convention.
That being said, you need to attach the following attributes to your MyColumns property:
[MergablePropert y(false), Localizable(tru e), DesignerSeria lizationVisibil ity(DesignerSer ializationVisib ility.Content), Editor("Syste m.Windows.Forms .Design.ColumnH eaderCollection Editor, System.Design , Version=2.0.0.0 , Culture=neutral , PublicKeyToke n=b03f5f7f11d50 a3a", typeof(UITypeEd itor)), SRDescription ("ListViewColum nsDescr")]
This will enable the property window to help with designing your columns.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message news:uM****** ********@TK2MSF TNGP06.phx.gbl. .. Hello,
I'm creating a control including a listview. I would like to be able to set the columns through the Design Tool in Visual Studio, so I created a parameter to access the columns of my listview:
private ListView.Column HeaderCollectio n myColumns { get { return(this.myL istView.Columns ); } set { this.myListView .Columns.Clear( );
foreach(Columns Header column in value) { this.myListView .Columns.add(co lumn); } }
Of course this is not working, I can insert my columns in the designer, but when I launch my application, the collection is empty. I'm sure what I did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daisy |
last post by:
I've started writing a listview, which currently draws my list to a pane,
and onclick, works out which row you've clicked on, from the co-ordinates of
the mouse, sets the .Selected property to the index of the item in my list,
and onpaint, I draw this with a selected box over it.
It's dawned on me, that this "list", being just text written...
|
by: Mad Joe |
last post by:
Hello!
Can someone help me, please? It's 6am, I don't have concentration,
feel desperate and I have a deadLine for my project (exam at my
university)..
How can I display ListView onMouse Click event?
Let's say that I just need a detailed view of columnHeaders. Somewhere
in my code there is already prepared array:
|
by: Navin |
last post by:
Hi,
I am making a code editor in C# and want to display line numbers to the
left. I have a UserControl with a ListView docked to the left edge and
a TextBox that makes up the rest. I am able to add items to the
ListView when a new line is entered in the TextBox (these items are
the line numbers). What I am not able to figure out is how to...
|
by: **Developer** |
last post by:
I need to sort the columns of a ListView.
Some columns contain dates and others contain integers.
What I did once before is in the Compare method I tried date and if that
failed I did Integer.
Seems kinda not nice - is there a better way?
Thanks
|
by: rb |
last post by:
Hi All,
Is there a property or method to keep the headercolumns from being
resized by the user
for a listview?
I am using Visual Basic in Visual Studio . net 2005
Thank you.
| |
by: David Gouge |
last post by:
Hi all,
Hope this is a simple one for you but i seem to be having a bit of a
mental block.
I have an inherited ListView (NewListView) class and an inherited
ListViewItem (NewListViewItem) class. How do i get my NewListView class
to accept NewListViewItems into and return NewListViewItems from the
Items collection.
|
by: --== Alain ==-- |
last post by:
Hi,
I'm coming back on the ListView component that i would like to design.
I finally finish to analyse how it should work (on paper).
So i have properties, methods and events that i should implement.
I found several points that must base component respects to implement it.
- it should implement a canvas/GDI to allow drawing (to allow...
|
by: Tom Bean |
last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an
item in a ListView and have encountered a something that seems strange to
me.
When the ListView is initially populated, no items are selected. When the
first item is selected by clicking either the left or right button, the
SelectedIndexChanged event fires but not the...
|
by: Lloyd Sheen |
last post by:
I was in a thread talking about how to populate a listview from a Linq
query. This got my curiosity up so I created a usercontrol which is a
listview which can be populated from a Linq query.
I has all the same properties / methods available to a listview but behind
the scenes it is really a virtual listview. It is quick to load (33K items...
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |