473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inheritance - Can't assign object to extended class

I want to extend the DataGridTextBox so I can access its IsInputKey protected method. I created the below class to do this

Public Class myDataGridTextBo
Inherits DataGridTextBo

Public Function CheckInputKey(ByVal keyData As Keys) As Boolea
CheckInputKey = IsInputKey(keyData
End Functio

Protected Overrides Function IsInputKey(ByVal keyData As Keys) As Boolea
'Some code her
End Functio

End Clas

My problem however occurs when I try to instantiate the object using DataGridTextBoxColumn.Textbox which is of type 'TextBox'. For example

Dim tbcName As DataGridTextBoxColum
Dim txtTB As TextBo
Dim txtDGTB As DataGridTextBo
Dim txtmyDGTB As myDataGridTextBo

tbcName = New DataGridTextBoxColum
tbcName.MappingName = "AnyValue

txtTB = tbcName.TextBox '* This works (Example A
txtDGTB = tbcName.TextBox '* This works (Example B
txtmyDGTB = tbcName.TextBox '* This fails with InvalidCastException (Example C

Prior to trying to extend the DataGridTextBox class, I was using Example B without any problem. Now, since the DataGridTextBox extends the TextBox class and one can assign a TextBox object to it with no problem, it shows I'm obviously missing something when I try to further extend the DataGridTextBox class.

I've also tried extending the TextBox class the same way and get the same error so I know I'm doing something wrong (since DataGridTextBox is an extension of TextBox) and it works.

I've looked at many examples on MSDN and can't find any that do this. Any help would be greatly appreciated
Jul 21 '05 #1
0 1236

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brian Jones | last post by:
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = def __init__(self): print 'called a'
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
15
by: scorpion53061 | last post by:
I am just now really starting to get into inheritance - controls, datasets, views all that stuff and I am seeing the enormous savings in performance and even watching the exe file size go down...
0
by: Mark G | last post by:
I want to extend the DataGridTextBox so I can access its IsInputKey protected method. I created the below class to do this Public Class myDataGridTextBo Inherits DataGridTextBo Public...
8
by: ^MisterJingo^ | last post by:
Hi all, I have a question regarding inheritance. I'll use the following code for an example (its been stripped down to the minimum): // code start using System; class Animal {
6
by: tshad | last post by:
I am playing with Inheritance and want to make sure I understand it. I have the following Classes: ******************************************* Public Class AuthHeader:Inherits SoapHeader Public...
36
by: Pacific Fox | last post by:
Hi all, haven't posted to this group before, but got an issue I can't work out... and hoping to get some help here ;-) I've got a base object that works fine with named arguments when called...
6
by: Manan | last post by:
Hi, i'm new to OOP concept. in college days i have read lots of good things about "inheritance" but does any one uses this concept in real life project ? or can some one tell me when it will be...
14
by: MartinRinehart | last post by:
Working on parser for my language, I see that all classes (Token, Production, Statement, ...) have one thing in common. They all maintain start and stop positions in the source text. So it seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.