Hi people!
I have created a class that contains a single DateTime property, called Date.
Like this
I have also created another class that has an Instance of MyDate stored insideCode:class MyDate { private DateTime _date; public MyDate(DateTime defaultValue) { _date = defaultValue; } public DateTime Date { get{return _date;} set{_date = value;} } }
Its all quite simple... What i want to do is bind the property MyDate in the MyOtherClass to the Text property of a TextBoxCode:public class MyOtherClass { private MyDate _myDate; public MyOtherClass { _myDate = new MyDate(DateTime.Now); } public MyDate MyDate { get{return _myDate;} set{_myDate = value;} } }
This is fine, when the code executes the ToString method of MyDate is called and the current date is displayed... Oh... the ToString method is not shown above...Code:this.TextBox1.DataBindings.Add("Text",anInstanceOfMyOtherObject,"MyDate")
Now when i change the value in the text box i want to update the value in anInstanceOfMyOtherObject.MyDate.Date
I have tried writting implicit conversions for converting string to MyDate objects but this isn't working. Any suggestions?
Thanks Rohan![]()




Reply With Quote