473,322 Members | 1,911 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.

control collection

I'm trying to create a custom listview that uses custom listviewitems. The listviewitems persist just fine in design mode. However, when I build the solution, the listview item doesn't show up. I've run some tests, and the item is still there. However, it's not displayed on the ui

Am I missing something simple? It's still there--why isn't it showing up

Thanks
Tod

Here's my code..

using System
using System.Collections
using System.ComponentModel
using System.ComponentModel.Design
using System.Drawing
using System.Drawing.Design
using System.Data
using System.Windows.Forms
using System.Windows.Forms.Design

namespace ST

[ToolboxItem(true)
public class ListViewEx : System.Windows.Forms.ListVie
{
private ListViewItemCollectionEx m_colItems

public ListViewEx(

SetStyle(ControlStyles.ResizeRedraw, true)
SetStyle(ControlStyles.AllPaintingInWmPaint, true)
SetStyle(ControlStyles.DoubleBuffer, true)

m_colItems = new ListViewItemCollectionEx(this);
[Browsable(true)
[Category("Behavior")
[Description("The items in the ListView.")
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)
Editor(typeof(CollectionEditor), typeof(UITypeEditor))
public new ListViewItemCollectionEx Item

get { return m_colItems;

[Serializable()
public class ListViewItemCollectionEx : System.Windows.Forms.ListView.ListViewItemCollecti o
{
private ListViewEx m_objParent

public ListViewItemCollectionEx(ListViewEx owner) : base(owner

// Set reference to parent ListViewEx
this.m_objParent = owner
public new ListViewItemEx this[int Index

get { return (ListViewItemEx) base[Index];
public void Add(ListViewItemEx objListViewItemEx

base.Add(objListViewItemEx)

// Give item a reference to parent listview
objListViewItemEx.m_objParent = this.m_objParent
public bool Contains(ListViewItemEx objListViewItemEx

return base.Contains(objListViewItemEx)
public void Remove(ListViewItemEx objListViewItemEx

// Remove item from listview
base.Remove(objListViewItemEx)

// Remove items reference to parent
objListViewItemEx.m_objParent = null;
public void IndexOf(ListViewItemEx objListViewItemEx

base.IndexOf(objListViewItemEx)

[Serializable()
[ToolboxItem(false)
[TypeConverter("STS.ListViewItemExConverter")
public class ListViewItemEx : System.Windows.Forms.ListViewIte
{
internal ListViewEx m_objParent

public ListViewItemEx() : base(

public class ListViewItemExConverter : System.ComponentModel.TypeConverte

public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType

if (destinationType == typeof(InstanceDescriptor)

return true
return base.CanConvertTo(context, destinationType)
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType
{
if (destinationType == typeof(InstanceDescriptor) && value is ListViewItemEx
{
ListViewItemEx lvi = (ListViewItemEx)value;
ConstructorInfo ci = typeof(ListViewItemEx).GetConstructor(new Type[] {})
if (ci != null) return new InstanceDescriptor(ci, null, false)
return base.ConvertTo(context, culture, value, destinationType)

Nov 16 '05 #1
0 2047

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

Similar topics

4
by: Mark | last post by:
How do you reference the caption of the label attached to a control on a form by first referencing the form? For example, textbox named Addr1 has an attached label with the caption "Address1"....
1
by: Rahim | last post by:
i want to change all the label control style Properties, server control properties at runtime how should i call all the label at runtime, which is present at webform, any collections???? i...
0
by: Tom | last post by:
I am developing a page that will contain multiple instances of a Composite Custom Control that i have developed. The problem is that the user will determine at run time how many of the control...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
3
by: Simon Harvey | last post by:
Hi All. In one of my user controls I add a textbox to a placeholder sitting on the user control. txtUsername = new TextBox(); txtUsername.ID = "txtUsername";...
1
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
0
by: Rene Aichinger | last post by:
Hi, I've created a server control (it inherits from WebControl) wich has a property of genertic collection type. The type of the generic collection is NavigationItem, a little class I've...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.