Hi,
I think I would do it like this. However I don't understand that button, a
menu looks more obvious to me. And for sure not that retro word "Load"
(although Microsoft uses it too standard in Load_Form).
\\\
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles
Button1.Click
Static staticNumber As Integer = 0
CreateClient(staticNumber.ToString)
staticNumber += 1
End Sub
Public Sub CreateClient(ByVal Caption As String)
Dim frm As New Form()
frm.MdiParent = Me
frm.Text = Caption
frm.Show()
frm.Focus()
frm.Name = "Prod 2008 - " & Caption
frm.Text = "Prod 2008 - " & Caption
' Button1.Enabled = False
End Sub
///
Be aware that the reference to this frm goes direct out of scope so you have
to reference it using the MDIParent.MdiChildren array.
http://msdn.microsoft.com/en-us/libr...en(VS.80).aspx
Cor
"iDesmet" <idesmet.work@gmail.comschreef in bericht
news:aad8816a-84ca-475a-8572-827b08a96f43@y21g2000hsf.googlegroups.com...
Quote:
Hallo,
>
For example, I have the following procedure to Load a form:
>
Public Sub LoadClient(ByVal Caption As String)
Dim frmClient As New frmClient()
frmClient.MdiParent = frmMainMDI
frmClient.Text = Caption
frmClient.Show()
frmClient.Focus()
>
frmMainMDI.Text = "Prod 2008 - " & Caption
frmMainMDI.btnClientNew.Enabled = False
End Sub
>
So to load it, I only call this: LoadClient("New Client")
>
But I need to write almost the same to load another form. The only
thing I change is frmClient and the buttom I want to disable in this
case.
>
So my question is this: Is it posible to make a generic procedure so I
only pass the values I want like in Caption? or I need a diferent
approach to acomplish this task? If so how?
>
Thanks in advance
>
Best Regards,
David Desmet