|
-
Feb 19th, 2009, 04:55 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] need help with user control
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.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Feb 19th, 2009, 06:50 AM
#2
Re: [2005] need help with user control
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?
-
Feb 19th, 2009, 07:24 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
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
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Feb 19th, 2009, 07:58 AM
#4
Re: [2005] need help with user control
 Originally Posted by adshocker
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.
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.
-
Feb 19th, 2009, 08:01 AM
#5
Re: [2005] need help with user control
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
-
Feb 19th, 2009, 08:05 AM
#6
Re: [2005] need help with user control
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.
-
Feb 19th, 2009, 08:08 AM
#7
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 1st, 2009, 11:31 PM
#8
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
hi,
need to ask in case i needed to create another user control.
how do i add a property to the databindings property?
thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 2nd, 2009, 10:09 AM
#9
Re: [2005] need help with user control
You call DataBindings.Add on the control. The first argument is the name of the control property to bind to.
-
Mar 5th, 2009, 06:37 PM
#10
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
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?
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 5th, 2009, 11:58 PM
#11
Frenzied Member
Re: [2005] need help with user 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.
-
Mar 6th, 2009, 12:05 AM
#12
Frenzied Member
Re: [2005] need help with 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.
-
Mar 11th, 2009, 04:01 AM
#13
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
 Originally Posted by FourBlades
hi,
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
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 11th, 2009, 05:18 PM
#14
Re: [2005] need help with user control
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.
-
Mar 11th, 2009, 11:28 PM
#15
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
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
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 11th, 2009, 11:52 PM
#16
Re: [2005] need help with user control
 Originally Posted by adshocker
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?
You can apply the ToolboxBitmap attribute to your class.
http://msdn.microsoft.com/en-us/libr...attribute.aspx
-
Mar 12th, 2009, 12:57 AM
#17
Thread Starter
Hyperactive Member
Re: [2005] need help with user control
this is great! thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|