Forms Question

  • Thread starter Thread starter Blacky
  • Start date Start date
B

Blacky

Hi

I'm trying to make a form that works like the form when you goto Tools ->
Options in VS.NET.

I have a ListView on the left hand side of form A with different items.
When double clicking on an Item, a different form, form B, will be displayed
next to the ListView. Excactly like the talked above form.

I'm creating a new form, form B, with all the controls needed. Then when
double clicking on an item, i do this...

clNewForm frmMaster = new clNewForm();

frmMaster.Owner = this;
frmMaster.Show();

This creates a new form, form B, that is not displayed with in the form,
form A, with the ListView.

But if I use frmMaster.ShowDialog()

It work perfectly, but I cannot use the ListView before closing frmMaster.

Can somebody plz help me?

Kind Regards
 
Blacky,

I wouldn't use a form for this. Rather, I would use a custom control,
and host the form yourself. Basically, the tree structure on the left would
make the control visiblity of the control based on which item was selected.
I would also define an interface that each control needs to implement, which
would allow you to extend the functionality easily.

Hope this helps.
 
Hi Blacky !
I'm trying to make a form that works like the form when you goto Tools ->
Options in VS.NET.


You could use a form with borders turned off or you may use a
UserControl. Anyway, here's what you can do:

Put a panel on your "mainform". Let's call this panel "panMother". This
will act as a parent for your form.
Then make a new form (let's call it Form2 for now)
When you click a button or whatever you got, then you could have code
like this:

panMother.Controls.Clear(); // removes any form currently loaded
private Form Form2 = new Form();
Form2.TopLevel = false;
panMother.Controls.Add(Form2);
Form2.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom |
AnchorStyles.Left | AnchorStyles.Right);
Form2.Show();

HTH
 
Thanks for the help. I've tested both sugestions and got both to work. The
one from Kai Bohli suits my needs better as I'm going to access large
databases. Have all controls active will be heavy on memory. Using Forms,
creating them and destroying them will work metter and not all data will be
in memory while not being used.

Once again, thank you very much!
 
Back
Top