accessing control properties

A

Andrew

Hi,

I'm a newbie at creating my own controls.
I've created my own control using:
foreach (Control lb_control in this.Controls[0].Controls)

This particular control is a ListBox. How do I access its properties such as
"SelectedItem", "Clear", "Item", etc ??

I can only see lb_control.ResetText(), lb_control.Name, lb_control.Text etc.

Thanks
Andrew
 
J

Jon Skeet [C# MVP]

Andrew said:
I'm a newbie at creating my own controls.
I've created my own control using:
foreach (Control lb_control in this.Controls[0].Controls)

This particular control is a ListBox. How do I access its properties such as
"SelectedItem", "Clear", "Item", etc ??

I can only see lb_control.ResetText(), lb_control.Name, lb_control.Text etc.

Cast it to a ListBox instead of just to Control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top