re mdi Apps

G

Grant Stephen

got your post thanks Cor but can't see how i can fit it in (beginners eh!!)
so far i can only get the following result
created frmMain which is a mdi container
placed a toolbar on frmMain
created frmChild
placed text box control on frmChild
button3 of this toolbar will open an instance of frmChild
button 4 on frmMain toolbar outputs the text value of text box control to a
message box
via sub on frmChild
however can only output the text value of the last instance of the form
regardless of which form has been selected

Thanks

Grant
 
C

Cor Ligthert

Grant,

I made a complete sample.
3 forms, 1= mdi with 2 and 3 you do nothing
you drag a buttonbar to form 1
in the properties from the container you add 2 buttons with in the Tag and
case sensitive
Form2 and Form3 (This to make it in an easy way language independent)

The rest you would be able to do yourself in my opinion.

A messagebox is not "on" a form, it is a mini form as you can make yourself
with showdialog by the way.


Cor

Than this code
\\\
Private Sub ToolBar1_ButtonClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _
Handles ToolBar1.ButtonClick
Select Case e.Button.Tag
Case "Form2"
mnuFrmHandling("Form2")
Case "Form3"
mnuFrmHandling("Form3")
End Select
End Sub
Private Sub mnuFrmHandling(ByVal frmName As String)
For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next
Dim frmNew As Form
Select Case frmName
Case "Form2"
frmNew = New Form2
Case "Form3"
frmNew = New Form3
End Select
frmNew.MdiParent = Me
frmNew.Show()
frmNew.WindowState = FormWindowState.Maximized
frmNew.Name = frmName
frmNew.BringToFront()
End Sub
///

I hope this helps?

Cor
 
G

Grant Stephen

again thanks Cor for your reply, however
what i want to do is determine which instance of "Form2"
is active, thus allowing me have several instances
of "Form2" open but to retrieve only the textbox.text of
active instance of "Form2"

Grant
-----Original Message-----
Grant,

I made a complete sample.
3 forms, 1= mdi with 2 and 3 you do nothing
you drag a buttonbar to form 1
in the properties from the container you add 2 buttons with in the Tag and
case sensitive
Form2 and Form3 (This to make it in an easy way language independent)

The rest you would be able to do yourself in my opinion.

A messagebox is not "on" a form, it is a mini form as you can make yourself
with showdialog by the way.


Cor

Than this code
\\\
Private Sub ToolBar1_ButtonClick(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) _
 
C

Cor Ligthert

Grant,

I did not try this one, can you try it yourself?
\\\
For Each ctr As Control In Me.ActiveMdiChild.Controls
If ctr.Name = "textbox1" Then
mytext = DirectCast(ctr, TextBox).Text
End If
Next
///

I hope this helps?

Cor
 

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