Listbox items with ToString override, display problem

jespermohl

Newcomer
Joined
Jan 21, 2005
Messages
3
Location
Copenhagen
My listbox displays an empty string when I add an form to it.
I tried to override ToString and set listbox.DisplayMember to a property.
It works when i use lbxHeader1.Items[1].ToString();

Does anybody have a clue what could be wrong?


This is my definitions:


public partial class TextDisplay : Form​
{​

public override string ToString() {...}​

}​

partial class Form1​
{​
this.lbxHeader1 = new System.Windows.Forms.ListBox();​
}​

public partial class Form1 : Form​
{​
private void lbxHeader1_MouseDoubleClick(object sender, MouseEventArgs e)​
{​
TextDisplay TextDispDialog = new TextDisplay();​
lbxHeader1.Items.Add(TextDispDialog);​
}​
}​
 
Last edited:
Back
Top