Hy Friends,
Using visual inheritance feature of .net, I've inherited a Form (Form2) from an existing form (Form1) of the same assembly or project. It's perfectly inherited and when I run the application it's executing fine. But when I open the inherited form (Form2) in designer, It throws an exception in form_load event of Parent Form (Form1) as code block in form_load event requires some data which will be available only when application runs. Due to this problem, I can not make changes in Inherited Form (Form2) using designer.
Now, my question is that, why It's going to call Form_Load event of Parent Form (Form1) while opening Inherited Form (Form2) in the designer. Is there any solution to that problem.
Please help.
Thanks.
4 1129 TRScheel 638
Recognized Expert Contributor
Hy Friends,
Using visual inheritance feature of .net, I've inherited a Form (Form2) from an existing form (Form1) of the same assembly or project. It's perfectly inherited and when I run the application it's executing fine. But when I open the inherited form (Form2) in designer, It throws an exception in form_load event of Parent Form (Form1) as code block in form_load event requires some data which will be available only when application runs. Due to this problem, I can not make changes in Inherited Form (Form2) using designer.
Now, my question is that, why It's going to call Form_Load event of Parent Form (Form1) while opening Inherited Form (Form2) in the designer. Is there any solution to that problem.
Please help.
Thanks.
Could you show code?
My guess is, though, that something like this is what you will find for form2's code: -
public class Form2 : Form1
-
{
-
public Form2() : base()
-
{
-
}
-
}
-
Though, i dont see why that wouldnt allow you to see Form2 in designer. I have never tried this though...
Could you show code?
here is the code: Form1 Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
}
private void Form1_Load(obje ct sender, EventArgs e)
{
MessageBox.Show ("Parent Form Load Event");
}
} Form 2 Code:
public partial class Form2 : Form1
{
public Form2()
{
InitializeCompo nent();
}
}
Now form_load event of Form1 is triggered when I open Form2 in designer and shows message box. But I don't want this behavior and I don't want form_load event to be triggered while opening designer.
Hi All,
The problem is that, because you are inheriting Form2 from Form1, when you open Form2 in the designer, the Form_Load event of Form1 will fire (and I assume events like Form_Activate, etc). I don't know if this is intentional or a bug, but I know there must be a couple of ways to get around it, but I think the easiest way would be to put error handling around the offending code (which you should actually already have done).
Hope this helps!
TRScheel 638
Recognized Expert Contributor
You have to remove Form_Load from the Load event handler of the Form1 instance created under Form2.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: angelag |
last post by:
I am currently taking a college course in Visual Basic.Net and I am a
beginner.
I bought Visual Studio.Net 2003 to do my homework at home. I built my
first project and e-mailed it to myself at school. When I tried to
open it in the lab, I got a message saying I couldn't open it because
it was created with a newer version. Evidently the lab is using Visual
Studio.Net 2002.
My professor doesn't just want the executable file, he wants...
|
by: Martin Bless |
last post by:
The good news:
Along with Python-2.4 comes really good news to Windows users. Yes,
you now CAN build extension modules yourself using the SAME C++
compiler and linker Python is built with itself. Everything you need
is available at no costs (except download hassle and installation
time). Once your system is set up properly its just a matter of
running 'python setup.py build'. No longer waiting for someone else to
build binaries and a...
|
by: Tom Lee |
last post by:
Hi,
I'm new to .NET 2003 compiler. When I tried to compile my
program using DEBUG mode, I got the following errors in the
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\include\xdebug file as folows. I need help to resolve
them ASAP:
cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D "
WIN32" /D "_W
INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
|
by: gerd |
last post by:
Hello,
I want to port an MFC Application from Visual Studio 6 MFC application to
Visual C++ 2005 express edition beta.
While building i get following error:
------ Build started: Project: OSTDLL, Configuration: Debug Win32 ------
Compiling...
StdAfx.cpp
|
by: Daniel A. Thomas |
last post by:
License required
Maybe you don't have this but have one of the products that
qualifies for the upgrade such as ...
Visual Studio .NET 2003 Professional
Visual Studio .NET 2003 Professional Special Edition
Visual Studio .NET 2003 Enterprise Architect
Visual Studio .NET 2003 Enterprise Developer
Visual Studio .NET 2002 Professional Edition
| |
by: Edwin Smith |
last post by:
I have a 2 form project in VS2005 that now hangs whenever I try to do
anything with the second form. This seems to have started when I added some
SQL tables from a Pervasive v.9 database using the Pervasive ODBC driver.
The devenv.exe process hangs and will not respond with about 50% cpu usage
and about 100 megs of memory used.
I am running it on an Athlon 64 bit dual core with 32 bit Windows XP pro. I
have 2 megs of memory so I don't...
|
by: Cramer |
last post by:
So, what is the relationship between Visual Studio and Visual Web Developer.
I find a lot of documentation on MSDN that presents Visual Web Developer as
it's own stand-alone product (which I'd expect of the Express editions), but
apparently there are NON Express versions of Visual Web Developer.
Is Visual Web Developer only built-in to Visual Studio 2008 Professional? I
see "Microsoft Visual Web Developer 2008" listed as an installed...
|
by: jwwicks |
last post by:
Introduction
This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who don't know how to use the IDE for best results.
Visual Studio automatically creates a number of...
|
by: Johnson |
last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio
2008 issue -- thus posting to 3 groups. Please don't be offended.
The problem I'm encountering is that Visual Studio closes unexpectedly and
without any error message being displayed, or error messages written to the
system logs. Visual Studio closes when I attempt to open an ASP.NET Web
application (not Web site) solution for which IIS is set as the project's...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |