I'm writing a suite of vb 2008 express applications supported by MySQL databases and needed a control for selecting a date sorted by four week periods. The supplied monthcalendar wasn't right for this so I decided to try my hand at creating a user control.
In this control, I dynamically add controls and assign events to them. On my main form, I dynamically add the user control and everything works just fine.
My problem now is where to go next. I'm unclear as to how to expose the dynamically created controls inside the user control to the main form, how to generate an event in the main form when I click on a dynamically created control inside the user control, or how I can access those controls properties in the user control from the main form.
This matters because I plan to use this period calendar control across multiple forms and want to populate the text properties of the user control controls from those forms, because the data I want to display depends on the forms that uses the user control.
I can work around that by accessing the MySQL database inside the user control to grab text data for the created controls, but then again, the user control needs to know what scenario is desired to be able to pick the correct table, etc.
I didn't post any code because I'm not asking someone to offer code as a bandaid fix. I'm just looking for user control examples or something in MSDN I can't seem to find. I googled this for a week and all I find is how to create an analog clock user control, but nothing in-depth on coding a fully interactive user control.
Thank you so much for your time!
Hop
In this control, I dynamically add controls and assign events to them. On my main form, I dynamically add the user control and everything works just fine.
My problem now is where to go next. I'm unclear as to how to expose the dynamically created controls inside the user control to the main form, how to generate an event in the main form when I click on a dynamically created control inside the user control, or how I can access those controls properties in the user control from the main form.
This matters because I plan to use this period calendar control across multiple forms and want to populate the text properties of the user control controls from those forms, because the data I want to display depends on the forms that uses the user control.
I can work around that by accessing the MySQL database inside the user control to grab text data for the created controls, but then again, the user control needs to know what scenario is desired to be able to pick the correct table, etc.
I didn't post any code because I'm not asking someone to offer code as a bandaid fix. I'm just looking for user control examples or something in MSDN I can't seem to find. I googled this for a week and all I find is how to create an analog clock user control, but nothing in-depth on coding a fully interactive user control.
Thank you so much for your time!
Hop
Last edited: