By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

re mdi Apps

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

"Grant Stephen" <gr***********@btopenworld.com>
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

Nov 21 '05 #2

P: n/a
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 andcase 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 yourselfwith 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

"Grant Stephen" <gr***********@btopenworld.com>
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

.

Nov 21 '05 #3

P: n/a
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

"Grant Stephen" <an*******@discussions.microsoft.com> schreef in bericht
news:16****************************@phx.gbl...
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) _
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

"Grant Stephen" <gr***********@btopenworld.com>
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

.

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.