Dim gls() As String = {"表B", "表C"} If e.Table.Current IsNot Nothing Then For Each gl As String In gls If e.Table.Current.DataRow.GetChildRows(gl).Count > 0 Then For Each g As String In gls Tables(e.Table.Name & "." & g).Visible = False Next Tables(e.Table.Name & "." & gl).Visible = True Exit For End If Next