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

reopening form many times and Data Binding

Hello!

My question regards opening (and re-opening) Form and the Load event.

I have a main form (frmMain) and I also have a data form (frmData).

In the main form I have created:

Private fData as new frmData()

And later, as my application is running, I open data form many times (even a
hundred times) like this

fData.RowId = ... ' there exists a public property of frmData called RowId
If (fData.ShowDialog(Me) = DialogResult.OK) THEN
...
ELSE
...
ENDIF

frmData has a private object of some class called "classData" and then I
want to bind some controls on frmData to properties in classData, like this:
....
Private cData as New classData()
.....
Me.txtValue1.DataBindings.Add(New Binding("Text", cData, "Value1"))

Where can I define the binding? When I try to define it after
InitialiseComponent() I got "OutOfMemory" Exception, so I decided to move it
and do the binding during the "Load" event (as It was shown in some MSDN
Magazine articles). But it appears that the Load event fires EVERY TIME
frmData opens (contrary to what the documentation states: Load Event -
"Occurs before a form is displayed for the first time.") and the second time
my form is opened
binding fails. I could create a variable "AlreadyBound" of type Boolean but
it seems a dirty solution for me. And then again I feel creating fData every
time it is opened and the disposing of it is a waste of time and resources.

I wait for any good clues regarding:
- how to open form multiple times (this is what I do with fData)
- how to have some operations performed every time the form is opened (like
clearing the data fields) while other only the first time the form is opened
(or when it is created in the memory)
- when (and how) to do the binding

Thanks in advance. Marcin Floryan.

Nov 22 '05 #1
4 1901
Hi Marcin,

I thought I asked you yesterday in the language.vb group what you mean with
"open" because that does not exist as far as I know, and that is just the
part not in your sample.

However I do not see that message either.

There is a show and hide and there is a way to create a form new.

Jest method robizc nowe alle nie jest do otwarte jak ja wiem.

Moze bardzo sle

:-)

Cor
Nov 22 '05 #2
Hi Marcin,

I thought I asked you yesterday in the language.vb group what you mean with
"open" because that does not exist as far as I know, and that is just the
part not in your sample.

However I do not see that message either.

There is a show and hide and there is a way to create a form new.

Jest method robizc nowe alle nie jest do otwarte jak ja wiem.

Moze bardzo sle

:-)

Cor
Nov 22 '05 #3
All I write regards VB.NET and each Form object in .NET has OpenDialog
method and has
Load event. I have no problem opening the form, or creating it. My problem
is with data binding and with strange behaviour of Open Event (contrary to
what the docs say).
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
Hi Marcin,

I thought I asked you yesterday in the language.vb group what you mean with "open" because that does not exist as far as I know, and that is just the
part not in your sample.

However I do not see that message either.

There is a show and hide and there is a way to create a form new.

Jest method robizc nowe alle nie jest do otwarte jak ja wiem.

Moze bardzo sle

:-)

Cor

Nov 22 '05 #4
All I write regards VB.NET and each Form object in .NET has OpenDialog
method and has
Load event. I have no problem opening the form, or creating it. My problem
is with data binding and with strange behaviour of Open Event (contrary to
what the docs say).
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
Hi Marcin,

I thought I asked you yesterday in the language.vb group what you mean with "open" because that does not exist as far as I know, and that is just the
part not in your sample.

However I do not see that message either.

There is a show and hide and there is a way to create a form new.

Jest method robizc nowe alle nie jest do otwarte jak ja wiem.

Moze bardzo sle

:-)

Cor

Nov 22 '05 #5

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

Similar topics

1
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
4
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
0
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
0
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
0
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.