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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The value doesn't appear in the inherited user control!!!

Status
Not open for further replies.

Shelyn

Programmer
May 15, 2003
18
MY
Hi All,

I created a text field user control (txtDouble), in which I do all the validation in this text field to only allow double data type to be entered.

In the form, any fields that need only double data type entry, I will inherit my user control (txtDouble). But I don't understand why the value cannot be loaded into the field. When I debug it, for example the value to txtInput1 (from txtDouble) is 10, it shows 10 when I debug, but when the form loaded, the value in txtInput1 is always 0. Why did it happen?

By the way, I set the txtDouble default value as 0.

Please help.

Or any suggestions on how to make use of user control as my form has 200 text fields in numbers and I need to do validation for all fields and it takes long time to write the validation code for each field. Is there any better way that all the fields can be inherited and the validation can be done in the ascendent?


Thanks.

 
How do you inherit? Like:

Public Class txtDouble()
Inherits System.Windows.Forms.TextBox

' ...
Public Sub New()
' ...
End Sub
End Class

Can you show us a little piece of code ?
 
The txtDouble is the ascendent user control, so in the form, I just drag it from the toolbox and use it.

I rename it in the form, for eg. txtInput1, and just use it as normal user control. It does run the validation events written in its ascendent (txtDouble). The only problem is it didn't display the value from database.

Is it the correct way? Coz i used to do it this way using Power Builder, but I am not familiar with VB.net.
 
It has no problem in populating the value from the database... only the inherited control can't display the value.
 
Are you missing a MyBase.Something call somewhere in your custom code? Good Luck!

Have a great day!

j2consulting@yahoo.com
 
Contract at 50-55 hrs a week makes it tough plus had all 4 wisdom teeth pulled. Thanks for asking!

Have a great day!

j2consulting@yahoo.com
 
So, no more wisdom from SBendBuckeye.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top