emi_sastra
asked on
SHOW FORM USING IMPLEMENTS INTERFACE
Hi All,
I have win app with Mdi Form :
1. ToolStrip with a button for
2. TabControl
I show child form to tabcontrol.
After a child form is added to tabpage, I click mdi form button to show another form that implement at the child form.
The problem is the form at tabpage is gone after the second child form is shown.
What's wrong ?
Thank you.
I have win app with Mdi Form :
1. ToolStrip with a button for
2. TabControl
I show child form to tabcontrol.
After a child form is added to tabpage, I click mdi form button to show another form that implement at the child form.
The problem is the form at tabpage is gone after the second child form is shown.
What's wrong ?
Thank you.
Impossible to tell without seeing some code....
ASKER
Hi Idle_Mind,
At mdi form :
Private Sub mnuInventoryMasterProduk_C lick(sende r As Object, e As EventArgs) Handles mnuInventoryMasterProduk.C lick
Dim frmBRWTMPRODUK As New ERV_INVENTORY.frmBRWTMPROD UK
With frmBRWTMPRODUK
Dim tbp As New TabPage
'Dim tbp As New CustomTabPage(frmBRWTMPROD UK)
tbp.Text = Me.mnuInventory.Text.ToUpp er & " - " & .Text
tbcERPMain.TabPages.Add(tb p)
.TopLevel = False
.FormBorderStyle = Windows.Forms.FormBorderSt yle.None
.Dock = DockStyle.Fill
tbp.Controls.Add(frmBRWTMP RODUK)
tbcERPMain.SelectedTab = tbp
.Show()
End With
End Sub
Thank you.
At mdi form :
Private Sub mnuInventoryMasterProduk_C
Dim frmBRWTMPRODUK As New ERV_INVENTORY.frmBRWTMPROD
With frmBRWTMPRODUK
Dim tbp As New TabPage
'Dim tbp As New CustomTabPage(frmBRWTMPROD
tbp.Text = Me.mnuInventory.Text.ToUpp
tbcERPMain.TabPages.Add(tb
.TopLevel = False
.FormBorderStyle = Windows.Forms.FormBorderSt
.Dock = DockStyle.Fill
tbp.Controls.Add(frmBRWTMP
tbcERPMain.SelectedTab = tbp
.Show()
End With
End Sub
Thank you.
ASKER
At Child Form :
Public Class frmBRWTMPRODUK
Implements InterfaceInventory
Public Sub ShowPendukungInventory() Implements InterfaceInventory.ShowPen dukungInve ntory
Dim frmMasterPendukungProduk As New frmMasterPendukungProduk
With frmMasterPendukungProduk
.ShowDialog(Me.Parent)
End With
frmMasterPendukungProduk = Nothing
End Sub
End Class
When showing form using this function has problem.
Thank you.
Public Class frmBRWTMPRODUK
Implements InterfaceInventory
Public Sub ShowPendukungInventory() Implements InterfaceInventory.ShowPen
Dim frmMasterPendukungProduk As New frmMasterPendukungProduk
With frmMasterPendukungProduk
.ShowDialog(Me.Parent)
End With
frmMasterPendukungProduk = Nothing
End Sub
End Class
When showing form using this function has problem.
Thank you.
ASKER
At mdi Form :
Private Sub btnMasterPendukung_Click(s ender As Object, e As EventArgs) Handles btnMasterPendukung.Click
Dim tc As TabControl = CType(Me.tbcERPMain, TabControl)
Dim TabP As TabPage = DirectCast(tc.TabPages.Ite m(tc.Selec tedIndex), TabPage)
Dim frm As Form = Nothing
For Each frm In TabP.Controls
frm.Close()
Next
If Not IsNothing(frm) Then
Try
DirectCast(frm, InterfaceInventory).ShowPe ndukungInv entory()
Catch ex As Exception
End Try
End If
End Sub
Thank you.
Private Sub btnMasterPendukung_Click(s
Dim tc As TabControl = CType(Me.tbcERPMain, TabControl)
Dim TabP As TabPage = DirectCast(tc.TabPages.Ite
Dim frm As Form = Nothing
For Each frm In TabP.Controls
frm.Close()
Next
If Not IsNothing(frm) Then
Try
DirectCast(frm, InterfaceInventory).ShowPe
Catch ex As Exception
End Try
End If
End Sub
Thank you.
ASKER
Inside frmBRWTMPRODUK (child form shown in tabpage)
Private Sub btnMasterPendukung_Click(s ender As Object, e As EventArgs) Handles btnMasterPendukung.Click
Dim frmMasterPendukungProduk As New frmMasterPendukungProduk
With frmMasterPendukungProduk
.ShowDialog(Me.Parent)
End With
frmMasterPendukungProduk = Nothing
End Sub
It works fine. The problem exist when using implements.
Thank you.
Private Sub btnMasterPendukung_Click(s
Dim frmMasterPendukungProduk As New frmMasterPendukungProduk
With frmMasterPendukungProduk
.ShowDialog(Me.Parent)
End With
frmMasterPendukungProduk = Nothing
End Sub
It works fine. The problem exist when using implements.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Silly me.
Let me try first.
Thank you.
Let me try first.
Thank you.
ASKER
Great. It works.
Thank you very much for your help.
Thank you very much for your help.