Edit A Subcontrol within a control
-
I am building a control, within this control is a data grid...The data grid needs to be changed depending on the form that it is on...but when you build a control and then drag it onto a form...you can no longer edit the controls that you placed on that control...any sugestions?
-- "Keyboard not found. Press < F1 > to RESUME. " Source unknown (appears in many common BIOSes as a real error message)
-
I am building a control, within this control is a data grid...The data grid needs to be changed depending on the form that it is on...but when you build a control and then drag it onto a form...you can no longer edit the controls that you placed on that control...any sugestions?
-- "Keyboard not found. Press < F1 > to RESUME. " Source unknown (appears in many common BIOSes as a real error message)
Polymorpher wrote:
The data grid needs to be changed depending on the form that it is on
The control shouldn't care about what form it's on. It should be modified by the form code only if necessary.
Polymorpher wrote:
you can no longer edit the controls that you placed on that control
What does this mean? How do you want to "edit the controls"??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Polymorpher wrote:
The data grid needs to be changed depending on the form that it is on
The control shouldn't care about what form it's on. It should be modified by the form code only if necessary.
Polymorpher wrote:
you can no longer edit the controls that you placed on that control
What does this mean? How do you want to "edit the controls"??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007My control contains a grid control as well as some other controls, when I drag my control onto a form from the toolbox, I want to be able to move the grid within my control and change some of the settings on the grid etc.
-- "Keyboard not found. Press < F1 > to RESUME. " Source unknown (appears in many common BIOSes as a real error message)
-
My control contains a grid control as well as some other controls, when I drag my control onto a form from the toolbox, I want to be able to move the grid within my control and change some of the settings on the grid etc.
-- "Keyboard not found. Press < F1 > to RESUME. " Source unknown (appears in many common BIOSes as a real error message)
You're going to have to add code to your control to handle dragging the grid around at design time. The designer won't do it for you because it doesn't support designing constituent controls seperate from the user control that contains them, at the controls runtime. The properties will all have to be re-exposed as public properties of the user control. A user control's runtime doesn't begin when the forms project the control is used in is finally run. A User Control's runtime begins when an instance of the control is created on the host form. From your description, it sounds like it would be better to just break the datagridview out on its own and not have it as a constituent of a user control.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007