|  |  | 
          
            | ผมมี Treeview 1 ตัวครับ เปิดโปรแกรมมาครั้งแรกสามารถเกิดเปิดฟอร์มต่างๆได้ปกติ แต่ถ้าหากเราปิดฟอร์มนั้นไปแล้วจะกดเปิดใหม่มันก็ไม่ขึ้นครับ 
 ตัวอย่าง
 
 Click Materials Invoice -> Materials Invoice Form Show -> Form Close -> Click Materials Invoice -> Form not show
 
 แต่ถ้าทำตามขั้นตอนนี้ขึ้นครับ คือไปกดเปิดหน้าต่างอื่นก่อนแล้วกลับมากดหน้าต่างเดิมจะขึ้นครับ
 
 Click Materials Invoice -> Materials Invoice Form Show -> Materials Invoice Form Close -> Click Requisition Materials -> Requisition Materials Form Show -> Click Materials Invoice -> Materials Invoice Form Show
 Code (VBScript)
 
 Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect
        Select Case TreeView1.SelectedNode.Name
            Case Is = "matinv"
                If Application.OpenForms().OfType(Of matinv).Any Then
                Else
                    Dim status As New matinv
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "req"
                If Application.OpenForms().OfType(Of requisition).Any Then
                Else
                    Dim status As New requisition
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "viewStock"
                If Application.OpenForms().OfType(Of stockremain).Any Then
                Else
                    Dim status As New stockremain
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "transfer"
                If Application.OpenForms().OfType(Of tranfer).Any Then
                Else
                    Dim status As New tranfer
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "matdetail"
                If Application.OpenForms().OfType(Of matDetail).Any Then
                Else
                    Dim status As New matDetail
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "unit"
                If Application.OpenForms().OfType(Of unitDetail).Any Then
                Else
                    Dim status As New unitDetail
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "typedetail"
                If Application.OpenForms().OfType(Of typeDetail).Any Then
                Else
                    Dim status As New typeDetail
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "process"
                If Application.OpenForms().OfType(Of processDetail).Any Then
                Else
                    Dim status As New processDetail
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "pic"
                If Application.OpenForms().OfType(Of user).Any Then
                Else
                    Dim status As New user
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
            Case Is = "monthly"
                If Application.OpenForms().OfType(Of monthly).Any Then
                Else
                    Dim status As New monthly
                    status.MdiParent = Me
                    status.Show()
                    status.Location = New Point(0, 0)
                End If
        End Select
    End Sub
  
  
 
 
 Tag : .NET, VB.NET, Windows
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2019-10-08 10:49:37 | By :
                          realizejoke | View :
                          949 | Reply :
                          1 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |