473,385 Members | 1,279 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,385 software developers and data experts.

Show function

Hello,

I would like to add some actions to show function of a form with Visual
Stuio 2005.
Is it possible?
Is it possible to create a new Show function which inherit of old it?

Best Regards.
May 25 '07 #1
6 5004
On May 25, 11:54 am, "Xavier PACOTTE" <xpaco...@pageup.frwrote:
Hello,

I would like to add some actions to show function of a form with Visual
Stuio 2005.
Is it possible?
Is it possible to create a new Show function which inherit of old it?

Best Regards.
Dear Xavier,

You can override the OnShown method or use the Shown event.

What exactly you want to achieve?

Moty

May 25 '07 #2
Perhaps overriding OnLoad() might be more appropriate; what are you
trying to do?

Marc
May 25 '07 #3
public class FormEx : Form
{
public new void Show()
{
//do your pre-stuff
base.Show();
//do your post-stuff
}

public new void Show(IWin32Window owner)
{
//do your pre-stuff
base.Show(owner);
//do your post-stuff
}
}

Xavier PACOTTE je napisao/la:
Hello,

I would like to add some actions to show function of a form with Visual
Stuio 2005.
Is it possible?
Is it possible to create a new Show function which inherit of old it?

Best Regards.
May 25 '07 #4
thank you for this answer.
it is ok.

"Miroslav Stampar" <mi**************@gmail.coma écrit dans le message de
news: 11**********************@g4g2000hsf.googlegroups.c om...
public class FormEx : Form
{
public new void Show()
{
//do your pre-stuff
base.Show();
//do your post-stuff
}

public new void Show(IWin32Window owner)
{
//do your pre-stuff
base.Show(owner);
//do your post-stuff
}
}

Xavier PACOTTE je napisao/la:
>Hello,

I would like to add some actions to show function of a form with Visual
Stuio 2005.
Is it possible?
Is it possible to create a new Show function which inherit of old it?

Best Regards.

May 25 '07 #5
On May 25, 12:13 pm, Miroslav Stampar <miroslav.stam...@gmail.com>
wrote:
public class FormEx : Form
{
public new void Show()
{
//do your pre-stuff
base.Show();
//do your post-stuff
}

public new void Show(IWin32Window owner)
{
//do your pre-stuff
base.Show(owner);
//do your post-stuff
}
}

Xavier PACOTTE je napisao/la:
Hello,
I would like to add some actions to show function of a form with Visual
Stuio 2005.
Is it possible?
Is it possible to create a new Show function which inherit of old it?
Best Regards.
Hi,

I wouldn't suggest using this solution since it's not polymorphic.

The following code will not do what you need:

Form frm = new Form1();
frm.Show();

Only if frm is of type Form1, the Form1 implementation of Show() will
be called.

Moty

May 25 '07 #6
Warning - this will only work if the caller knows about FormEx; if the
caller only knows about Form, then the original Show will be called,
and your code will not be executed.

As such, this is *not* recommded best-practice. The OnLoad / OnShown
methods (and matching events) are far more reliable.

Marc
May 25 '07 #7

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

Similar topics

1
by: Roger Godefroy | last post by:
Hi There, I would like to show details in another (hidden) TR. It should look like something like on an image I have found wich illustrates it exactly is I want: ...
6
by: R. Stormo | last post by:
I have a problem showing output that is comming from a script. If I make a script running at commandline it do work and everything are showing. But when I try to execute it from within my proggy...
10
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer...
6
by: greenflame | last post by:
I have been working for some time on a script that will show a matrix with the elements aligned on the right for sometime and finally got it to work. Then I did some patching up and ran the script...
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
4
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
3
by: timplx | last post by:
Hello all, New to javascript and have never worked with programming languages like c++, so my logic in some of these statements might be incorrect or redundant Got a problem with my page......
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.