Hello all
In VB6, if you referred to a property or a some property of a control
of an unloaded form, it caused a form_load, and fired the Form_Load event.
I have a lot of code that depends on this behaviour: thus in order to achieve some initialization of my form , I have a general purpose routine as follows -
Public Function ShowForm(ByRef FormToShow As Object, ByRef ShowModal As Boolean, ByRef FormTag As String) As Boolean
-
' routine shows a modal form: loads form and activates it before displaying
-
Dim ModalState As Byte
-
ModalState = IIf(ShowModal, VB6.FormShowConstants.Modal, VB6.FormShowConstants.Modeless)
-
With FormToShow
-
' FormTag parameter indicates what state to load the form in
-
.Tag = FormTag ' triggers Load event
-
' manually force code called by Form_Activate routine to execute before showing form
-
' note: must be a public function
-
'2/7/01 CG Make the function FormInitialize a boolean one whereever it occurs; if it returns false, unload the form instead of showing it.
-
'FormInitialize is a public boolean function in any form which is shown by this routine
-
'It will typicall use the value of the form's tag, set above to perform initialization tasks
-
If .FormInitialize Then
-
'If the form's FormInitialize function returns true, show the form in the modal state indicated in the ShowModal parameter
-
VB6.ShowForm(FormToShow, ModalState)
-
ShowForm = True
-
Else
-
FormToShow.Close()
-
end if
-
end With
-
End Function
-
In VB6 line 7 .Tag = FormTag would set the form's tag to FormTag and force a form_load: this does not seem to happen in VB.NET 2005
Is there anyone out there who can give me some insight into this? I would have thought that the behaviour, much complained of in other places, almost had to be like that: what does it mean to refer to the .TAG property of a form that is not loaded?
By way of experiment, I have tried setting other properties of the form in this routine, but the form_load will not fire in these cases either.
Thank you
Charles Geach.
2 7029 Plater 7,872
Recognized Expert Expert
The Tag property in .net is just a scratch space to store extra data (as far as I can figure)
Generally: -
Dim form1 As New Form1()
-
form1.Show()
-
will show the form and trigger the LOAD event
The Tag property in .net is just a scratch space to store extra data (as far as I can figure)
Generally: -
Dim form1 As New Form1()
-
form1.Show()
-
will show the form and trigger the LOAD event
Well, thank you: the tag property in VB6 was the same. The thing is that I want to do some initialization before the form is shown, and in fact only show the form if that initialization succeeds.
As I said in my code snippet, referring to any property or control of the form would in VB6 trigger the form load.
Thank you again for any further insight into this
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: STom |
last post by:
I have a C# Winforms app that has 5 Winforms, lets say A through E.
A: Data entry. When data is entered here in any field, values are updated on
forms C, D, E.(Not B)
B: Data entry form. When data is entered here in any field, values are
updated on forms C, D, E (not A).
I am considering using delegates to fire events from forms A & B. In forms
C, D, E I will have functions with the same signature and even the same name
that just...
|
by: Ori |
last post by:
Hi,
I would like to create some mechanism to handle all the exceptions
which will happen in my application.
I have one form which is the base form while all the other forms
inherit from it.
I try to find a way to "register" the base form to the Error handling
, but I don't know how….
|
by: Tarun Mangla |
last post by:
Hi
I am facing a problem. I've made an application in which two forms are
there. One if Login form and another is main form. The problem is that,
after getting authenticated from the database the main form is opened. But
the login form is not getting closed. I am using the following code:
It is in the load of the main form.
this.ParentForm.Close();
|
by: Kurt Denhoff |
last post by:
I have an odbc connection on a Winforms UserControl when used within a
WinForms project it works fine but when I use it on an aspx page the object
doesn't show. The IIS log indicates code 200(successfully loaded). I am
suspecting this may be an issue with being fully trusted dll. I experimented
with the ODBC connection on a Webform control - it worked fine. I put the
ODBC connection on the aspx page - it worked fine. I put the...
|
by: Chad Miller |
last post by:
I currently have a base form that I inherit. The base for has a custom
event. The event will not raise threw the inherited form. I was wondering
if events work threw inheritance or should I use some other method?
--
Chad Miller
President and Director of Software Development
Predictive Concepts, Inc.
www.predictiveconcepts.com
407.327.9910
| |
by: guy |
last post by:
Two of us are working on a Winforms solution (5 projects) and are using VSS,
and VB.NET 2003
with one form, regularly on closing it in design mode, or sometimes on
checking it in, Sourcesafe prompts for to do a check out for edit even though
an edit is not required. it will then not allow a check out Cancel. If the
checkout is allowed then most of the controls, primarily those on tab pages
or panels. drop off the form. The controls still...
|
by: Rene |
last post by:
I keep getting the following error every time I compile the solution under
VS 2005:
----------------
Error 5
Unable to copy file "obj\Debug\xyz.dll" to "bin\Debug\xyz.dll". The process
cannot access the file 'bin\Debug\xyz.dll' because it is being used by
another process.
----------------
|
by: dgk |
last post by:
I want to use certain events but only when the form is finished with
the Load event. Obviously I can set a boolean flag but I was looking
around for anything in Me that might do the same thing but I don't see
it. Did I miss it?
|
by: parez |
last post by:
Hi,
Whats the winforms equivalent of asp.net page load event?
I am trying to clear a status message field every time a user clicks
on any of the buttons..
|
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: 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: 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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |