hi all,
i created a user control for a datetimetextbox. i used a textbox to hold the value. now i'm having a problem as to how i can add a Text property and also add this into the DataBindings Property.
thanks.
Printable View
hi all,
i created a user control for a datetimetextbox. i used a textbox to hold the value. now i'm having a problem as to how i can add a Text property and also add this into the DataBindings Property.
thanks.
You can't add a Text property because Text is inherited from the Control class, so your UserControl already has a Text property. Think of a different name.
Why have you created a UserControl anyway? If all you want is a TextBox then why not inherit the TextBox class? If you want more functionality then does the DateTimePicker control not already provide that?
hi,
i don't see the text property of my user control on the properties window. how do i make use of it? it's also not in the databindings collection property.
i'm trying to create a datetimetextbox that accepts null values unlike the datetimepicker.
i also checked the quantum software solution which i found on one of your threads. but when i checked the site, one of the prerequisites was .Net 1.1 and i don't think my client will want to have .Net 1.1 installed. i'm currently using .Net 2.0.
thanks
The original version of WFC was built on .NET 1.1. The last version that I saw on their site was .NET 2.0, which will also work for .NET 3.0 and 3.5 apps. They just haven't updated the web site text properly.Quote:
Originally Posted by adshocker
The QSS control was a customised DateTimePicker, not a customised TextBox or UserControl.
If you check the VB.NET CodeBank you'll see that I've posted a nullable DTP control there. I created that before QSS released the .NET 2.0 version of WFC but, after I did some more testing, I discovered there was a bug. Once QSS released WFC for .NET 2.0 I didn't bother trying to fix it. You should either use QSS WFC for .NET 2.0 or else use my code as a starting point for creating your own customised DateTimePicker the "right" way.
Note that I created mine in the same way that QSS created their original version but made some modifications to get around an issue that arose out of a difference between how .NET 1.1 and .NET 2.0 handled certain Windows messages. It seemed to work and certainly did overcome that issue but, as I said, I found another.
Actually, I just took a look at the page for QSS WFC and it specifically says .NET 2.0.
http://www.quantumsoftware.com.au/Pr...omponents.aspx
The download page says you need .NET 1.1 but that's obviously an oversight on the part of their web designers.
http://www.quantumsoftware.com.au/Do...s/Default.aspx
Just for interests sake, QSS are located about an hour from where I live, which I didn't know when I first found that WFC library on the web. I was just looking for a WinForms data repeater control and there's was the only freebie. Of course, MS have finally created their own but it took a while, plus WFC has other good stuff in it.
ok... thanks.
hi,
need to ask in case i needed to create another user control.
how do i add a property to the databindings property?
thanks.
You call DataBindings.Add on the control. The first argument is the name of the control property to bind to.
thanks..
one more thing.. how about the Text property issue i mentioned in my earlier post. how come it doesn't appear on the properties window when i use the control?
If it's a composite control that you wrote, it's because you didn't expose a property that wraps the Text property of the TextBox contained in your user control.
http://msdn.microsoft.com/en-us/libr...c2(VS.71).aspx
Just poke around in MSDN until you discover what you are looking for.
hi,Quote:
Originally Posted by FourBlades
i'm still not able to expose the Text property of the UserControl. i've read the article on the link you provided but i didn't see any samples on how to do this as well as on how to add the Text property to the DataBindings property of the control at design time.
thanks
You shouldn't be using the Text property of the UserControl at all. Add your own property and bind to that. Inside that property you can get and set the Text property of the TextBox.
thanks...
one more thing... when i add my usercontrol to my toolbox it looks like a wheel or something... is there any way i can use my own image for it?
thanks
You can apply the ToolboxBitmap attribute to your class.Quote:
Originally Posted by adshocker
http://msdn.microsoft.com/en-us/libr...attribute.aspx
this is great! thanks. :D