Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

composite control issue

Status
Not open for further replies.

arevans

Programmer
Aug 21, 2007
5
US
I created a composite control - called DateBox - that inherits from UserControl. It combines a DateTimePicker control (dateTimePicker1) together with a TextBox control (textBox1). In the designer, the textbox control is overlaid on the datetimepicker control so that you see the textBox and just the arrow of the datetimepicker. I can't get the following code to work, and I am not sure why:

void dateTimePicker1_ValueChanged(object sender,
EventArgs e)
{
this.textBox1.Text = this.dateTimePicker1.Value.ToShortDateString();
}

Can anybody help me? Thanks,
 
I don't see a reason why that wouldn't work.

If you stick a breakpoint in that method, does it get called after changing the value?

If not then the event has become unlinked/unwired.

 
Thanks, JurkMonkey. I got it to work. As you said, the Value_Changed event must have become unlinked, somehow.

Followup question: Is there a way to change the height of a textbox control / datetimepicker control? If I try to change the property setting to say 25, it defaults back to 20.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top