|
|
Dear All,
i have a class A. Class B derives class A and class C derives from class B and class D derives from class c. Now i need to call a method of class A from class D. is it possible? if so how can i acheive this. Is there any facility in C# that helps me to call the methods any of the classes A, B, C from class D? very urgent
Thanks in advance
Ramesh.Kanjinghat
|
|
|
|
|
Have you heard About Inheritance. this will help you.
Inheritance[^]
Regards,
Satips.
|
|
|
|
|
Dear Satips,
I know very well what inheritance is. Here my problem class A has a method Method1 and Class B inherits class A and Class C inherits class B where Class C overides the Method1 and class D inherits class C. know when i call Methodi from class D the Method1 of class C will be called. but i want to call the Method1 of class A. We can use super keyword in C++. is there any thing in C# that helps us to acheive this? got this time you got it?
thanks in advance
Ramesh.Kanjinghat
|
|
|
|
|
Hello,
I think you have to do a little trick here.
In class C you need a additional method, which calls the base.Method (method from class A).
public override void MethodFromA()
{
}
public void BaseMethodFromA()
{
base.MethodFromA();
}
In class D you have to override the base method again and call the additional method in class C.
public override void MethodFromA()
{
BaseMethodFromA();
}
Maybe there is some cleaner solution, which I'm not aware of, but I think it will work!
All the best,
Martin
|
|
|
|
|
|
|
No, not once the method has been hidden (with override or new ).
|
|
|
|
|
I am developing a dynamic DataGridView Control but the default columntype is DatagridviewTextBoxColumn I want to change it to DataGridViewCheckBox column.
Need help
![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
Hi,
Here is the code snippet:
private void Form1_Load(object sender, EventArgs e)
{
DataGridView dgrid = new DataGridView();
DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn();
col.DataPropertyName = "check";
dgrid.Columns.Add(col);
DataTable dt = new DataTable();
dt.Columns.Add("check");
DataRow dr = dt.NewRow();
dr["check"] = true ;
dt.Rows.Add(dr);
dgrid.DataSource = dt;
this.Controls.Add(dgrid);
}
Thanks,
Gopal.S
|
|
|
|
|
Thanks for reply.......
Actually I have predefined no.s of rows and columns in a datagridview and all the columns are textboxtype I want that when i click a cell it will automaticaly convert to datagridviewcheckboxcell.
your help be truly appreciated...
![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
Greetings,
I am currently coding some small-scale automation tools for my department and have been running into some issues as I am a beginner to Win32 coding.
I need to read and parse the text from another application's StatusStrip. I am assuming it's a StatusStrip as sending either an SB_GETTEXT or WM_GETTEXT message to the control's handle retrieves nothing. However, it may be a custom control as getting the child windows of this control only returns a handle to a StatusBar Progress Bar control.
I am hoping that it is not a custom control and I am just missing some reason as to why the ToolStripStatusLabels are not showing up as children of the StatusStrip control.
I have also been having issues trying to read from a ListView in this app, but I believe it's a custom control as well because I have no issues reading from another app's ListViews by virtually allocating memory and all of that jazz.
I do know that the app I'm having difficulty with uses a lot of the newer .Net controls that the other app's don't.
So, if anyone has any insight as to how I would retrieve the text from another app's StatusStrip, I would be extremely grateful.
Thanks,
Damien
|
|
|
|
|
Please find the keyword "object inspector" in codeproject search. there are a lot of articles (eg: this one).
try to inspect StatusStrip Text by using those programs. if those programs can read the text that you want then you can find out how those programs work ...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
thank you so very much. was unable to find programs of this nature before. i guess i just didn't know where to look .
this will help a lot for everything i am doing.
once again, thanks!
|
|
|
|
|
The documentation for OpenIcon says that it will restore a window to its previous size and location. This isn't happening - it is restoring the window but not to its previous size. Is there something extra that needs to be done when calling it from C#? The ReturnValue indicates success.
<br />
[DllImport("user32.dll")]<br />
static extern bool OpenIcon(IntPtr hwnd);<br />
<br />
...<br />
<br />
IntPtr wHandle = process.MainWindowHandle;<br />
bool ReturnValue = OpenIcon (wHandle);<br />
|
|
|
|
|
Im a beginner with C#.I want to create a program to store students and courses, each student can have one course at a time and a course can belong to two students or one..
I have microsoft access to create the classes and import them to Visual Studio 2005..
Im using visual studio 2005 and I want to find out the easiest way of doin these sort of programs, programs that can be used to store data, manipulate it and delete it.
As I have said this is probably an easy task for most but Im struggling..
Im very familiar with java(inheritance, polymorphism, generics and other things relating to classes) but I want to use C#...
Please help..
Is this chair taken
|
|
|
|
|
Bonsta wrote: Im very familiar with java(inheritance, polymorphism, generics and other things relating to classes) but I want to use C#...
OK - then you shouldn't have too much trouble, the syntax is similar, and I'm sure there's plenty of articles, even on this site, that cover the DB basics.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Can anyone explain me what an inline procedure is ?
|
|
|
|
|
I didn't think there was such a thing in C#. In C+, inline is a compiler suggestion.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I didn't think there was such a thing in C#
There is but you have no control over it, it's something that the JIT compiler does if it deems it necessary.
|
|
|
|
|
Just like C++ then ? :P
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yep , I'm not even sure you can find out when it's been JITted, I remember someone a few years ago having real trouble tracking down a bug and it was eventually sussed out that the method had been inlined. This might have been in a beta version though.
|
|
|
|
|
i want to use splitter control in vc# 2005, but how to do ?
thanks
|
|
|
|
|
Drag and drop it from toolbox on your form
|
|
|
|
|
you joking!?
i know this, but i don't know how to set it's properties and attributes ?
|
|
|
|