How to reference existing form.

I

Ibai Peña

Hi,

I have got 2 problem that seem trivial, but can´t fix.

1- I have 2 form, frmMain and frmDetails. In frmMain, I create frmDetails
and show it. How did I reference the frmMain form from frmDetails code? I
would like to show it, but I don´t want to use the X button to go back.

2- The default form setting should show the X button, but I get the OK
button!! The ControlBox and MinimizeBox controls are both set to true. What
is it wrong? How did I get the X button?

Thanks in advance,
 
P

Paul [Paradise Solutions]

Hi

1) You can't reference frmMain from frmDetails as frmDetails won't have
a reference to frmMain (unless someone want to correct me).

2) "OK" appears when you ShowDialog() the form, "X" if you just Show().
Are you developing against CE or PocketPC?


Paul
 
P

Paul [Paradise Solutions]

So am I, so I stand by what I said - just checking in case you were on
CE - have not used/developed against that.

If you need data transfer between the forms, it's probably best to put
any information in properties on the second form, and load it from the
first via ShowDialog()
Then, after the form has been closed, query the properties from the
first form. The Dispose() the second.

If you don't want the user to have to tap the "OK" that the ShowDialog()
will create, use a separate button.

Hope this helps a little.


Paul
 
I

Ibai Peña

Thanks for your replay. I will have a look to the method of transfering
data.

But the X and OK buttons doesn´t behave as spected. I create the frmDetails
form using this code:

frmDetails Entradas = new frmDetails(Usuario);
Entradas.Show();

And the frmDetails properties are set like this:

this.ControlBox = true;
this.MinimizeBox = true;

It is supoused to display an X, but the OK is displayed instead of it. Any
idea about what am I doing wrong?

Thanks again,
--
Ibai Peña
Movetek Integración Móvil
Paul said:
So am I, so I stand by what I said - just checking in case you were on
CE - have not used/developed against that.

If you need data transfer between the forms, it's probably best to put
any information in properties on the second form, and load it from the
first via ShowDialog()
Then, after the form has been closed, query the properties from the
first form. The Dispose() the second.

If you don't want the user to have to tap the "OK" that the ShowDialog()
will create, use a separate button.

Hope this helps a little.


Paul
I´m developing against PocketPC.


--
Ibai Peña
Movetek Integración Móvil
"Paul [Paradise Solutions]" <Paul@Don'tChuffingSpamMe.com> escribió en el
mensaje
Hi

1) You can't reference frmMain from frmDetails as frmDetails won't have
a reference to frmMain (unless someone want to correct me).

2) "OK" appears when you ShowDialog() the form, "X" if you just Show().
Are you developing against CE or PocketPC?


Paul


Ibai Peña wrote:


Hi,

I have got 2 problem that seem trivial, but can´t fix.

1- I have 2 form, frmMain and frmDetails. In frmMain, I create
frmDetails

and show it. How did I reference the frmMain form from frmDetails code?
I

would like to show it, but I don´t want to use the X button to go back.

2- The default form setting should show the X button, but I get the OK
button!! The ControlBox and MinimizeBox controls are both set to true.
What

is it wrong? How did I get the X button?

Thanks in advance,
 
I

Ibai Peña

I have just found the reason. I was testing the app in Pocket PC 2000 and
looks like it doesn´t support the X button. In newer OS-s works fine.

Thanks anyway.

--
Ibai Peña
Movetek Integración Móvil
Ibai Peña said:
Thanks for your replay. I will have a look to the method of transfering
data.

But the X and OK buttons doesn´t behave as spected. I create the frmDetails
form using this code:

frmDetails Entradas = new frmDetails(Usuario);
Entradas.Show();

And the frmDetails properties are set like this:

this.ControlBox = true;
this.MinimizeBox = true;

It is supoused to display an X, but the OK is displayed instead of it. Any
idea about what am I doing wrong?

Thanks again,
--
Ibai Peña
Movetek Integración Móvil
Paul said:
So am I, so I stand by what I said - just checking in case you were on
CE - have not used/developed against that.

If you need data transfer between the forms, it's probably best to put
any information in properties on the second form, and load it from the
first via ShowDialog()
Then, after the form has been closed, query the properties from the
first form. The Dispose() the second.

If you don't want the user to have to tap the "OK" that the ShowDialog()
will create, use a separate button.

Hope this helps a little.


Paul
I´m developing against PocketPC.


--
Ibai Peña
Movetek Integración Móvil
"Paul [Paradise Solutions]" <Paul@Don'tChuffingSpamMe.com> escribió en el
mensaje
Hi

1) You can't reference frmMain from frmDetails as frmDetails won't have
a reference to frmMain (unless someone want to correct me).

2) "OK" appears when you ShowDialog() the form, "X" if you just Show().
Are you developing against CE or PocketPC?


Paul


Ibai Peña wrote:


Hi,

I have got 2 problem that seem trivial, but can´t fix.

1- I have 2 form, frmMain and frmDetails. In frmMain, I create

frmDetails

and show it. How did I reference the frmMain form from frmDetails code?

I

would like to show it, but I don´t want to use the X button to go back.

2- The default form setting should show the X button, but I get the OK
button!! The ControlBox and MinimizeBox controls are both set to true.

What

is it wrong? How did I get the X button?

Thanks in advance,
 
P

Paul [Paradise Solutions]

Glad you found your answer.

Paul
I have just found the reason. I was testing the app in Pocket PC 2000 and
looks like it doesn´t support the X button. In newer OS-s works fine.

Thanks anyway.

--
Ibai Peña
Movetek Integración Móvil
Thanks for your replay. I will have a look to the method of transfering
data.

But the X and OK buttons doesn´t behave as spected. I create the
frmDetails

form using this code:

frmDetails Entradas = new frmDetails(Usuario);
Entradas.Show();

And the frmDetails properties are set like this:

this.ControlBox = true;
this.MinimizeBox = true;

It is supoused to display an X, but the OK is displayed instead of it. Any
idea about what am I doing wrong?

Thanks again,
--
Ibai Peña
Movetek Integración Móvil
So am I, so I stand by what I said - just checking in case you were on
CE - have not used/developed against that.

If you need data transfer between the forms, it's probably best to put
any information in properties on the second form, and load it from the
first via ShowDialog()
Then, after the form has been closed, query the properties from the
first form. The Dispose() the second.

If you don't want the user to have to tap the "OK" that the ShowDialog()
will create, use a separate button.

Hope this helps a little.


Paul

Ibai Peña wrote:


I´m developing against PocketPC.


--
Ibai Peña
Movetek Integración Móvil
"Paul [Paradise Solutions]" <Paul@Don'tChuffingSpamMe.com> escribió en
el

mensaje

Hi

1) You can't reference frmMain from frmDetails as frmDetails won't
have
a reference to frmMain (unless someone want to correct me).

2) "OK" appears when you ShowDialog() the form, "X" if you just
Show().
Are you developing against CE or PocketPC?


Paul


Ibai Peña wrote:



Hi,

I have got 2 problem that seem trivial, but can´t fix.

1- I have 2 form, frmMain and frmDetails. In frmMain, I create

frmDetails


and show it. How did I reference the frmMain form from frmDetails
code?
I


would like to show it, but I don´t want to use the X button to go
back.
2- The default form setting should show the X button, but I get the
OK
button!! The ControlBox and MinimizeBox controls are both set to
true.
What


is it wrong? How did I get the X button?

Thanks in advance,
 
J

Justin Weinberg

You can make an instance of any form a Shared / static member of something
(like make a Nav class and assign an instance of your form to it). Then you
can reference it to your heart's content. Be aware though, you are making
the assumption that you are only interested in one instance of the form.

This is how GDI+ Architect deals with panels, for example. It doesn't make
sense to have more than one "fill panel" so it uses a static shared member
and displays it as necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top