473,407 Members | 2,598 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,407 software developers and data experts.

Help with referencing base class

I built a windows control which inherits from the windows datagrid
class

Public Class XDataGrid
Inherits System.Windows.Forms.DataGrid
Private _AutoSizeDataGrid As Boolean
Private _AutosizeColumns As Boolean
..
..
..
..
I have found some code which can be used to autosize the columns in a
windows datagrid. This works fine if you put the code in a form.
However I want to put the code in my custom control (xdatagrid) and
have it work on my base (inherited) datagrid class.

Here is the code

1 Dim t As Type = MyBase.GetType

2 Dim m As Reflection.MethodInfo = t.GetMethod("ColAutoResize",
Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)

3 Dim i As Integer = MyBase.FirstVisibleColumn
4 Dim j As Integer = MyBase.VisibleColumnCount
6 Do While i < j
7 m.Invoke(MyBase, New Object() {i})
8 i = i + 1
9 Loop

The problem is that line 7 expects to invoke the method on a datagrid
object. However, I cannot get a reference to the underlying datagrid
object that my xDatagrid inherits from.

Me will reference my xdatagrid object which doesn't work
Mybase will work for lines 1,2,3 and 4 but m.Invoke won't except
Mybase as a parameter.

Anyone out there who can make this work?

Erick

Nov 8 '06 #1
0 691

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

Similar topics

10
by: Macka | last post by:
A few pieces of information first: * I have a class called Folder which represents a row of data in a database table. The data access side of things is not an issue. * The table has a parent...
2
by: Mike Taylor | last post by:
I'm trying to create a base page class for my project (am new to ASP.NET, so am a bit stumped) - I'm using VS.NET 2003, btw. OK, my dummy base page class is shown below: using System; using...
1
by: Mike | last post by:
Hello, I am attempting to develop a class that will inherit from System.Web.UI.Page to serve as a the base class for all of the code behind classes in my web application. I would like to store...
5
by: Russell Warren | last post by:
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object heirarchy, or to the rules regarding variable...
0
by: DahrkDaiz | last post by:
Ok so I have a base class and several inherited classes. The base class has 3 Delegate Objects so that the inherited classes can redefine search functions (note, virtual will not work in this case)....
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.