473,322 Members | 1,405 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,322 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 1234

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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.