|
hi,
for each "subform" use a "user control".
In the area where you want the subform to appear add a correctly sized panel.
then you can make your user control's parent the panel and add the usercontrol to the panels controls collection.
when you want to use a different usercontrol just remove the original from the panels control collection and add the new one.
a new user control can be added to a solution by right clicking on the solution in the solution explorer and doing an Add new Item (vs2005)
select a usercontrol and then you will get a screen you can add components to.
when you are done
at the menu button click event you can do something like (VB pseudocode)
dim myUc as UserControl = new UserControl
myUC.parent = parentpanel
parentpanel.controls.add myUc
..
dont forget to remove the old UC fromthe parentpanel collection , otherwise it will still try and display and its z-order may be higher than the new one so it will be "above" it
hope this helps
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
Thanks Martin & TDDragon.
I tried working with both & Both are good solutions. I prefer only 1 control per screen - in that scenario UC is best. I also need to have a Report and a form with Letter templates, RichTextBox to write letter. Will UC be able to handle this? Also will UC be able to manage with DB, as I got to work with DB a lot.
In MDI, can I ahve control over opening N number of forms. Like if same form is opened, I can just bring it to front but if I want to open only 2 forms max at a time. Is it possible.
Please guide me accordingly, so I can finalize which o choose and start working on it at the earliest.
Thanks
Terry
|
|
|
|
|
Hi,
a UC is in effect a form in the designer
just drag and drop what you need.
as far as scope is concerned a textbox in a uc is addressed from outside the UC in this way:
dim myuc as MYUC = new MYUC
myuc.Texbox.Text = "text"
but all controls that go in a form , goes into a uc
martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
with UC you should be able to do all the things you want (works pretty much the same as form)
to have control over openening number of forms in mdi you can do it like following:
when openen a form (user clicked to open it)
first check if the form already exist
iterate true the mdichildren collection of you're main form and if you find a form of the same type as the one that needs to be opened just put that form on top (property bringtofront or something)
of you want to be able to open max2 forms do the same but use counter. then after you iterated true the forms look at counter
dim counter as integer = 0
for each f as form in frmmain.mdichildren
if f.gettype.equals(gettype(frmsubformthatneedstobeopened)) then
counter =+1
end if
next
if counter <2 then
open new form
else
'do something
end if
hope this helps
|
|
|
|
|
look at the mdiparent property of a form
it will do excactly what you want
you can add a form to you're main form as follow
mnuclick
dim frm as new form1
frm.mdiparent = me
frm.show
-- modified at 4:53 Thursday 9th August, 2007
this does require that you put the mdiproperty (at design) of your main form to true
|
|
|
|
|
Hi,
I think Control.SetTopLevel() method is part of the solution when applied to a form.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Like Luc said, you can change a form so it behaves move like a control. Have you ever looked at the inheritance tree for the Form class? It derives from Control. So, it's very easy to treat a form just like it was a control. All you have to do is change one little property:
Dim myNewForm As New WhatEverForm
myNewForm.TopLevel = False
myNewForm.Location = New Point(30, 30)
Me.Controls.Add(myNewForm)
|
|
|
|
|
Thanks All of you.
You all have helped me decide which and what type should I use.
According to you all, I hace used UserControl and Form too. Like Luc and Dave said, I am displaying my form as a Control. If user opens another form, the first one is only active until user closes it, the second soesn't come on top. Just needed to add 1 line, which I was wondering you guys have missed out.
cd = New CustomerData()
cd.TopLevel = False
cd.SetBounds(0, 30, cd.Width(), cd.Height())
Me.Controls.Add(cd)
cd.Show()
Thanks a lot to all of you for your devotion, interest and guidance. I highly appreciate your help. I have voted all of you 5 points.
Thanks
Terry
|
|
|
|
|
Hi all
I need to move a control in my program
|
|
|
|
|
|
do you mean a usercontrol or a standard control??
-- modified at 4:54 Thursday 9th August, 2007
if you mean usercontrol provide me with an email and I'll mail you a example project I just created for someone else
I can't post it here and the code to long
You can mail me from this site (use email instead of reply)
|
|
|
|
|
Is this[^] what you're talking about?
|
|
|
|
|
Hi
i am new to vb.net, i develop a project in vb.net(.net version 2005) with some crystal report and i am using some .dll files for project.
i create a setup file for that project and installed in another PC , it doesnt contain .net, when i run the project it throws an error in the crystal report.But the forms are running without error, but the crystal report throws the following error "The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception"
please help me
Karthik
|
|
|
|
|
Is Crystal Reports installed on the target machine ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I'm sorry to post the same question twice..but i hv no other go..
I want to enter some ids (4 or 5) into a new address group in outlook express thru VB. I searched whereever i could but could'nt find any help..
Plz help me out..
Thnx in advance.
The name is Sandeep
|
|
|
|
|
See if this helps you::
http://en.allexperts.com/q/Visual-Basic-1048/OutLook-Express-Address-Book.htm
|
|
|
|
|
I've come across some sample code and at the top of the code, after the imports and before the class declaration, it says module BLAH. What is a module. I've never seen this before.
Thanks
Tom
Tom Wright
tawright915@gmail.com
|
|
|
|
|
MSDN says:
A Module statement defines a reference type available throughout its namespace. A module (sometimes called a standard module) is similar to a class but with some important distinctions. Every module has exactly one instance and does not need to be created or assigned to a variable. Modules do not support inheritance or implement interfaces. Notice that a module is not a type in the sense that a class or structure is — you cannot declare a programming element to have the data type of a module.
You can use Module only at namespace level. This means the declaration context for a module must be a source file or namespace, and cannot be a class, structure, module, interface, procedure, or block. You cannot nest a module within another module, or within any type. For more information, see Declaration Contexts and Default Access Levels.
A module has the same lifetime as your program. Because its members are all Shared, they also have lifetimes equal to that of the program.
Modules default to Friend (Visual Basic) access. You can adjust their access levels with the access modifiers. For more information, see Access Levels in Visual Basic.
All members of a module are implicitly Shared.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
So do I access the subs and functions of a module as if they were in my code? I do not need to declare it or instantiate it?
Tom
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Hi,
I suggest you try it. And look it up on MSDN. Or read a book on VB.NET
In fact the combination of these is the best way to make real progress.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
How can I make a Column on DataGridView accept only Numbers .. like Phone or price field >>>
jooooo
|
|
|
|
|
Hi jooooo
In design mode, select your data grid, select Edit Column from proeprtys, select your column from left panel and from right side options, select DataGridViewCellStyle prperty. Click on .. btn. In format, select Numeric for phone number with Decimal 0 and for price you can go for Numeric or Currency fomrat also. After setting this, if user enters anything else, Datagrid will throw exception and not allow user to input anything else.
Hope this helps the best
Thanks
Terry
|
|
|
|
|
Thanks Terry..
I did it ... but it's stell accepting non numeric keys and didn't make any exception ....
Many thanks for this Forum and all developers here ...
jooooo
|
|
|
|
|
I need some advice on how to handle semi global variable. I have had this issue before but currently its with a tracesource. I currently have a tracesource for each command I am creating in a toolbar. This way I can tell which command is giving me trouble. However I created a module called utilities that contains many subs and functions that I use between all of them. How do I set the values for this tracesource? The commands all have a oncreate sub that I use for the others so they are only class level. I can create the tracesource on the initialization of the toolbar but then its a global variable right? I am going to probably have this problem on several variable or objects so I would like to do this the best way.
Thanks
BlizzardIce
|
|
|
|
|
What is a 'semi global' variable ? I've never heard of such a thing.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|