pointeman
asked on
CheckedListbox Control Items Add?
I have a Win app using a custom user control which contains a CheckedListbox.
Q. How can I add items to the custom control like: checkedListbox.Items.Add(. ..)?
Q. How can I add items to the custom control like: checkedListbox.Items.Add(.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The first code you provided worked famously. What does your latest code do?
public void AddItemToListBox ( ListViewItem lvItem )
{
myCustomControl.GetListCon trol().Ite ms.Add ( lvItem );
}
public void AddItemToListBox ( ListViewItem lvItem )
{
myCustomControl.GetListCon
}
ASKER
opps, spoke to soon. I thought it was part of the actual control, but I see it access the control for items...
The last code is not mine, it is williamcampbell's code. He assumes a different underlying control, but your control does not allow ListViewItems, not even ListItems. It only allows general objects (which could be ListViewItems, but I'm not sure that would work).
I'm not sure what you mean with your last statement. Do you mean it doesn't work for you anymore?
I'm not sure what you mean with your last statement. Do you mean it doesn't work for you anymore?
ASKER
This code works well:
public CheckedListBox.ObjectColle ction Items { get { return checkedListBox.Items; } }
I have a new problem: The user control makes some labels and textboxes disappear in VS designer. Also cannot place more than one custom user control on win form without making eithor or both disappear.
public CheckedListBox.ObjectColle
I have a new problem: The user control makes some labels and textboxes disappear in VS designer. Also cannot place more than one custom user control on win form without making eithor or both disappear.
That's quite a different problem, I won't mind helping you there, but consider the one q. per thread principle from EE... The place where you should look is in the this.DesignMode (to distinguish design mode code to run mode code). Do you mean other controls that do not belong to this control? Sound like some repaint problem, or that the actual size of your user control (the canvas) is larger than it should be.
Open in new window