Public Class Frm_Main
    Private Function Terminate() As Boolean
        Dim Msg As New System.Text.StringBuilder("프로그램을 종료하시겠습니까?")
        If MsgBox(Msg.ToString, MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "종료") = MsgBoxResult.Ok Then
            End
        Else
            Return True
        End If
    End Function

    Private Sub MakeList_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Me.CHk_Modify()
        e.Cancel = Me.Terminate
        'If Not Me.IreaDataSet1.HasChanges Then Return '//변경된게 없으면 바로 나간다.
        'If MsgBox("변경된 데이터를 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "저장확인") <> MsgBoxResult.Ok Then
        '    Me.IreaDataSet1.RejectChanges()
        'Else
        '    Try
        '        Me.BindingSource1.EndEdit()
        '        Me.ssableAdapter.Update(Me.IreaDataSet1.Maintable)
        '        IreaDataSet1.AcceptChanges()
        '        view1.ActiveSheet.GetDataView(True)
        '    Catch ex As Exception
        '        MsgBox("데이터베이스 업데이트중 오류가 발생했습니다" & vbCrLf & vbCrLf & ex.ToString, MsgBoxStyle.Critical, "ERROR")
        '        Me.BindingSource1.CancelEdit()
        '        IreaDataSet1.RejectChanges()
        '        view1.ActiveSheet.GetDataView(True)
        '    End Try
        'End If
    End Sub

    Private Sub MakeList_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.F12 AndAlso e.Control Then
            If ETCLOGIN.ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.bt_others.Visible = True
                IsPro = True
            Else
                IsPro = False
            End If
        End If
    End Sub

    Private Sub MakeList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.view1.ASetting_Load(False)
        Me.Text = My.Application.Info.ProductName & " Ver. {0}.{1:00}.{2}.{3}"
        Me.Text = System.String.Format(Me.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

        Me.view1.Font = New Font(ViewFont.FontName, ViewFont.FontSize, Me.Font.Style)   '//글자정보 불러오기
        ' Me.ToolStrip1.Font = New Font(MenuFont.FontName, MenuFont.FontSize, Me.Font.Style)   '//글자정보 불러오기
        Me.bn.Font = New Font(MenuFont.FontName, MenuFont.FontSize, Me.Font.Style)   '//글자정보 불러오기
        Me.StatusStrip1.Font = New Font(MenuFont.FontName, MenuFont.FontSize, Me.Font.Style)   '//글자정보 불러오기
        Me.Display_Data()    '//데이터를 보여준다.
        Me.SETTOOLTIP()
        Me.SetFarPoint()
    End Sub
    Private Sub SETTOOLTIP()
        Dim TMSG As New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("더블클릭시에는 세부내역을 표시합니다")
        TMSG.AppendLine("[총수량] 은 세부내역의 갯수로 자동변경되므로 수정이 불가능합니다.")
        TMSG.AppendLine()
        TMSG.AppendLine("<단축키 : ENTER:다음칸 , SHIFT+TAB:이전칸 , ALT+ENTER:윗칸복사>")
        TMSG.AppendLine("<단축키 : DELETE:현재칸 지우기 , SHIFT+DELETE 현재줄 삭제>")
        TMSG.AppendLine("<단축키 : SPACE-BAR:현재칸 편집>")
        TMSG.AppendLine("<단축키 : CTRL + 마우스휠 : 화면크기를 조절합니다>")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.view1, TMSG.ToString)

        'TMSG = New System.Text.StringBuilder()
        'TMSG.AppendLine()
        'TMSG.AppendLine("데이터베이스의 내용을 다시 조회합니다.")
        'Me.bt_find.ToolTipText = TMSG.ToString
        'Me.ToolTip1.SetToolTip(Me.SortGroup1, TMSG.ToString)

        'TMSG = New System.Text.StringBuilder()
        'TMSG.AppendLine()
        'TMSG.AppendLine("검색문자의 우선순위 : 숫자->영문자->한글")
        'TMSG.AppendLine("    ->0  은 000 보다 우선순위가 높습니다.")
        'Me.ToolTip1.SetToolTip(Me.SerchGroup1, TMSG.ToString)
    End Sub

    Private Sub SetFarPoint()
        Me.view1.AEnterToNextItem()
    End Sub

    Private Sub CHk_Modify(Optional ByVal prompt As Boolean = True)
        Dim Cnt As Integer = 0
        Me.bs.EndEdit()
        If Not Me.IreaDataSet1.HasChanges Then
            NOTICE("변경된 내용이 없습니다", Me.lb_msg)
            Return
        End If
        If prompt Then
            If MsgBox("변경된 데이터를 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "저장확인") <> MsgBoxResult.Ok Then Return
        End If
        NOTICE("잠시만 기다려주세요...(적용하는중)", Color.Blue, Me.lb_msg)
        Me.Refresh()

        Try
            Cnt = Me.TA_Main.Update(Me.IreaDataSet1.MainTable)
            Me.TA_JUNJU.Update(Me.IreaDataSet1.jjutable)
            Me.TA_ETC.Update(Me.IreaDataSet1.EtcTable)
            Me.TA_JIJUNG.Update(Me.IreaDataSet1.jjungtable)
            Me.TA_Cable2.Update(Me.IreaDataSet1.Detail_Cable2)
            Me.TA_CableLabel.Update(Me.IreaDataSet1.Detail_CableLabel)
            Me.TA_Cable.Update(Me.IreaDataSet1.Detail_Cable)
            Me.TA_Deung.Update(Me.IreaDataSet1.Detail_Deung)
            Me.TA_Karo.Update(Me.IreaDataSet1.Detail_karo)
            Me.TA_Kiki.Update(Me.IreaDataSet1.Detail_kiki)
            Me.IreaDataSet1.AcceptChanges()
            NOTICE(Cnt & "개의 데이터가 적용되었습니다", Color.Green, Me.lb_msg)
        Catch ex As Exception
            MsgBox("데이터베이스 변경중 오류가 발생했습니다" & vbCrLf & vbCrLf & ex.ToString, MsgBoxStyle.Critical, "ERROR-")
            Me.bs.CancelEdit()
            Me.IreaDataSet1.RejectChanges()
            NOTICE("적용오류 : " & ex.ToString, Color.Tomato, Me.lb_msg)
        End Try


    End Sub

    Public Sub Display_Data()   '//뷰에데이터를 표시한다.
        NOTICE("데이터 조회중...", Me.lb_msg)
        Dim I As Integer = 0
        Me.TA_Main.Fill(Me.IreaDataSet1.MainTable)
        'Dim Dv As New DataView(Me.IreaDataSet1.Maintable, Me.SerchGroup1.GetWhere(False, False, False), Me.SortGroup1.GetSort(False), DataViewRowState.CurrentRows)

        Me.bs.DataSource = Me.IreaDataSet1.MainTable 'Dv
        NOTICE(Me.view1.ActiveSheet.RowCount & "개의 목록이 검색되었습니다", Me.lb_msg)
    End Sub

    Private Sub Delete_itm(Optional ByVal prompt As Boolean = True)

        If Me.bs.Current Is Nothing Then Return

        Dim DRv As DataRowView = bs.Current
        If DRv("id") <= 6 Then
            MsgBox("샘플데이터는 삭제할 수 없습니다", MsgBoxStyle.Information, "확인")
            Return
        End If

        Dim V_Type As Int16
        Dim A As New System.Text.StringBuilder("경고 : 해당데이터와 하위데이터가 삭제됩니다")
        A.AppendLine()
        A.AppendLine("계속하시겠습니까?-취소불가")

        If prompt Then
            If MsgBox(A.ToString, MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "삭제확인") <> MsgBoxResult.Ok Then Exit Sub
        End If

        Dim DelIDX As Integer   '//관리Id이다.
        With Me.view1
            DelIDX = .Cells(.ActiveRowindex, "ID").Value '//0번째값은 관리id이다
            V_Type = .Cells(.ActiveRowindex, "번호찰구분").Value
        End With

        'MsgBox(DelIDX)
        'MsgBox(V_Type)

        'Return

        CHk_Modify(False)
        'Me.bs.RemoveCurrent()    '//현재템을 삭제한다.
        '전주세부테이블에서 전부 죽인다.

        Dim Cmd As New OleDbCommand("delete from 전주관리  where id=" & DelIDX, Me.TA_JUNJU.Connection)
        If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
        Cmd.ExecuteNonQuery()

        Dim DelCnt As Integer = 0
        Select Case V_Type
            Case 0
                'Me.Text = "가공(일반) 가져오기"
                Cmd = New OleDbCommand("delete from  전주세부  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()

                'Me.TA_JUNJU.Fill(Me.IreaDataSet1.jjutable, DelIDX)
                'Me.PRB1.Minimum = 0
                'If Me.IreaDataSet1.jjutable.Rows.Count > 0 Then
                '    Me.PRB1.Maximum = Me.IreaDataSet1.jjutable.Rows.Count - 1
                '    Me.PRB1.Value = 0
                '    For Each Z As DataRow In Me.IreaDataSet1.jjutable.Rows
                '        Z.Delete()
                '        DelCnt += 1
                '        If PRB1.Value < Me.PRB1.Maximum Then Me.PRB1.Value += 1
                '    Next
                'End If
                'NOTICE(DelCnt & "개의 세부데이터가 삭제되었습니다", Color.Red, Me.lb_msg)
            Case 1
                'Me.Text = "지중(일반) 가져오기"
                Cmd = New OleDbCommand("delete from  지중세부  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()

            Case 9
                'Me.Text = "중요수용 가져오기"
                Cmd = New OleDbCommand("delete from  기타세부  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()

            Case 2
                'Me.Text = "정액등 가져오기"
                Cmd = New OleDbCommand("delete from  Detail_Deung  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()


            Case 4
                'Me.Text = "가공(기기) 가져오기"
                Cmd = New OleDbCommand("delete from  기기세부  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()

            Case 6
                'Me.Text = "지중(맨홀표시찰및계통도) 가져오기"
                Cmd = New OleDbCommand("delete from  Detail_cable  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()


            Case 7
                'Me.Text = "지중(케이블표시라벨) 가져오기"
                Cmd = New OleDbCommand("delete from  Detail_CableLabel  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()



            Case 8
                'Me.Text = "지중(기기표시찰) 가져오기"

                Cmd = New OleDbCommand("delete from  Detail_Cable2  where 관리id=" & DelIDX, Me.TA_JUNJU.Connection)
                If Cmd.Connection.State <> ConnectionState.Open Then Cmd.Connection.Open()
                Cmd.ExecuteNonQuery()

            Case Else
                'Me.Text = "번호찰 가져오기(" & 관리구분 & ")"
        End Select
        Display_Data()
    End Sub

    Private Sub CustFP1_ButtonClicked(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles view1.ButtonClicked
        Dim Active As Boolean = False
        With Me.view1

            If e.Column = .ColIndex2("그림") Then    '//그림연결메뉴이다
                '//가공번호찰만 그림연결을 한다.
                If IsPro = False Then
                    MsgBox("이 기능은 더이상 사용할 수 없습니다", MsgBoxStyle.Critical, "확인")
                Else
                    If .Cells("번호찰구분").Value = 0 Then  '//번호찰 종류 0은 일반 9는 기타번호찰                  
                        Dim A As New PicList(Me.view1.ActiveSheet.Cells(Me.view1.ActiveSheet.ActiveRowIndex, 0).Value)
                        A.MdiParent = Me.ParentForm
                        A.Show()
                    Else    '//
                        NOTICE("그림연결은 [가공]번호찰만 가능합니다", Color.Red, Me.lb_msg)
                        'MsgBox("지원되지 않는 기능입니다", MsgBoxStyle.Information, "확인")
                    End If
                End If
            End If
        End With
    End Sub

    Private Sub view_detail()
        CHk_Modify()   '//변경여부를 묻늗느. 종료한다.    'qr코드  --가공일반만 적용됨

        Dim Rowindex As Short = Me.view1.ActiveSheet.ActiveRow.Index
        Dim ID, NAME, BIGO, DAN, V_DATE, si, hom, kwan, kwan1, kwan2 As String
        Dim V_Type As Int16 = 0


        '//데이터를 가져온다.
        Dim Dr As System.Data.DataRowView = Me.bs.Current
        ID = Dr("ID") '.Cells(Rowindex, 0).Value

        If Dr("날짜") Is DBNull.Value Then
            V_DATE = ""
        Else
            V_DATE = Dr("날짜") '.Cells(Rowindex, 4).Value
        End If

        If Dr("거래처명") Is DBNull.Value Then
            NAME = ""
        Else
            NAME = Dr("거래처명") '.Cells(Rowindex, 4).Value
        End If

        If Dr("비고") Is DBNull.Value Then
            BIGO = ""
        Else
            BIGO = Dr("비고") '.Cells(Rowindex, 4).Value
        End If

        If Dr("단가") Is DBNull.Value Then
            DAN = ""
        Else
            DAN = Dr("단가") '.Cells(Rowindex, 4).Value
        End If

        If Dr("시공자") Is DBNull.Value Then
            si = ""
        Else
            si = Dr("시공자") '.Cells(Rowindex, 4).Value
        End If

        If Dr("홈페이지") Is DBNull.Value Then
            hom = ""
        Else
            hom = Dr("홈페이지") '.Cells(Rowindex, 4).Value
        End If

        If Dr("관리") Is DBNull.Value Then
            kwan = ""
        Else
            kwan = Dr("관리") '.Cells(Rowindex, 4).Value
        End If

        If Dr("관리1") Is DBNull.Value Then
            kwan1 = ""
        Else
            kwan1 = Dr("관리1") '.Cells(Rowindex, 4).Value
        End If

        If Dr("관리2") Is DBNull.Value Then
            kwan2 = ""
        Else
            kwan2 = Dr("관리2") '.Cells(Rowindex, 4).Value
        End If


        V_Type = (Me.view1.ActiveSheet.Cells(Rowindex, 10).Value) '//번호찰 종류 0은 일반 9는 기타번호찰
        'MsgBox(V_Type)

        If V_Type = 0 Then   '//일반가공번호찰이다.
            '            Dim A As New AddEpole(ID, V_DATE, NAME, BIGO, DAN, si, hom, kwan, kwan1, kwan2)
            Dim A As New AddEpole(ID, V_DATE, NAME, BIGO, DAN, si, hom, kwan, kwan1, kwan2)
            A.Show()
        ElseIf V_Type = 9 Then '//기타번호찰(현재로서는 고압중요수용표찰
            Dim A As New AddEpoleETC(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 1 Then '//지중번호찰(현재로서는 고압중요수용표찰
            Dim A As New AddEpoleJJ(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 2 Then '//정액등
            Dim A As New AddEpoleDung(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 4 Then '//기기용
            Dim A As New AddEpolekiki(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 6 Then '//지중(케이블)
            Dim A As New AddEpoleCable(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 8 Then '//지중(케이블)
            Dim A As New AddEpoleCable2(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        ElseIf V_Type = 7 Then '//지중(케이블선로표시라벨)
            Dim A As New AddEpoleCableLabel(ID, V_DATE, NAME, BIGO, DAN)
            A.Show()
        End If
        'If A.ShowDialog = Windows.Forms.DialogResult.OK Then Me.bt_find.PerformClick()
    End Sub


    Private Sub CustFP1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles view1.KeyDown
        e.Handled = True
        e.SuppressKeyPress = False
        If e.Shift AndAlso e.KeyCode = Keys.Delete Then '/delete
            e.Handled = True
            Delete_itm(True)
        End If
    End Sub

    Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
        Delete_itm(True)
    End Sub

    Private Sub bt_commit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_commit.Click
        If Not Me.IreaDataSet1.HasChanges Then
            NOTICE("변경된 데이터가 없습니다", Color.Red, Me.lb_msg)
            Return
        Else
            CHk_Modify()
        End If
    End Sub

    Private Sub bt_cancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_cancel.Click
        If Not Me.IreaDataSet1.HasChanges Then
            NOTICE("변경된 데이터가 없습니다", Color.Red, Me.lb_msg)
            Return
        Else
            Me.IreaDataSet1.RejectChanges()
            NOTICE("변경된 데이터가 복원되었습니다", Color.Blue, Me.lb_msg)
        End If
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Me.Close()
    End Sub
    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        Delete_itm(True)
    End Sub

    Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click
        CHk_Modify()
    End Sub

    Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton8.Click
        If Not Me.IreaDataSet1.HasChanges Then
            NOTICE("변경된 데이터가 없습니다", Color.Red, Me.lb_msg)
            Return
        Else
            Me.IreaDataSet1.RejectChanges()
            NOTICE("변경된 데이터가 복원되었습니다", Color.Blue, Me.lb_msg)
        End If
    End Sub

    Private Sub bt_close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_close.Click
        Me.Close()
    End Sub

    Private Sub view1_CellDoubleClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles view1.CellDoubleClick
        view_detail()
        e.Cancel = True
    End Sub

    Private Sub view1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles view1.Enter
        NOTICE("목록을 더블클릭하면 세부내역을 볼 수 있습니다", Me.lb_msg)
    End Sub

    Private Sub view1_CellClick(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles view1.CellClick

    End Sub

    Private Sub ToolStripButton9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_find.Click
        CHk_Modify()   '//변경여부를 묻늗느. 종료한다.
        Display_Data()
    End Sub

    Private Sub ToolStripButton9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ToolStripButton11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt5.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleETC(MaxId + 1)
        f.MdiParent = Me.ParentForm
        Select Case PoleEtcState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() '  If f.ShowDialog = Windows.Forms.DialogResult.OK Then Me.bt_find.PerformClick()
    End Sub

    'Private Function GetPAss2() As Boolean
    '    If Admin Then Return True
    '    Dim A As DialogResult = LoginForm2.ShowDialog
    '    Dim TExt As String = LoginForm2.PasswordTextBox.Text
    '    If A = Windows.Forms.DialogResult.OK Then
    '        If TExt = "haegwang" Then
    '            Return True
    '        Else
    '            Return False
    '        End If
    '    Else
    '        Return False
    '    End If

    'End Function

    Private Sub bt_jongak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleDung(MaxId + 1)
        'f.MdiParent = Me.ParentForm
        'Select Case PoleEtcState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
        '    Case "MAX"
        '        f.WindowState = FormWindowState.Maximized
        '    Case "MIN"
        '        f.WindowState = FormWindowState.Minimized
        '    Case Else
        '        f.WindowState = FormWindowState.Normal
        'End Select
        f.Show() '  If f.ShowDialog = Windows.Forms.DialogResult.OK Then Me.bt_find.PerformClick()

    End Sub

    Private Sub bt_savecolsize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_savecolsize.Click
        Me.view1.ASetting_Save(False)
    End Sub

    Private Sub bt_etcprog1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'XLSOldtonew.Show()
    End Sub

    Private Sub bt_etcprog2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        XLSSync.Show()
    End Sub

    Private Sub mbt_configStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mbt_config.Click
        Config.ShowDialog()
    End Sub

    Private Sub mbt_oldttonew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mbt_oldttonew.Click
        ' If IsPro Then XLSOldtonew.Show()
    End Sub

    Private Sub mbt_xlssync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mbt_xlssync.Click
        If IsPro Then XLSSync.Show()
    End Sub

    Private Sub mbt_writeauth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mbt_writeauth.Click
        Dim auth As New MyAuth

        Dim NewKey As String = InputBox("인증번호를 입력하세요 (인증번호는 숫자로만 이루어져 있습니다)")
        If IsNumeric(NewKey) = False Then
            MsgBox("프로그램을 재실행 하세요", MsgBoxStyle.Information, "확인")
            End
        End If
        auth.SetAuth(NewKey, My.Application.Info.DirectoryPath & "\epole.ini")
        MsgBox("프로그램을 재실행 하세요", MsgBoxStyle.Information, "확인")
        End
    End Sub

    Private Sub bt_etc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt6.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleDung(MaxId + 1)
        'f.MdiParent = Me.ParentForm
        'Select Case PoleEtcState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
        '    Case "MAX"
        '        f.WindowState = FormWindowState.Maximized
        '    Case "MIN"
        '        f.WindowState = FormWindowState.Minimized
        '    Case Else
        '        f.WindowState = FormWindowState.Normal
        'End Select
        f.Show() '  If f.ShowDialog = Windows.Forms.DialogResult.OK Then Me.bt_find.PerformClick()
    End Sub

    Private Sub bt_aa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_aa.Click
        AboutBox1.ShowDialog()
    End Sub

    Private Sub BT11MenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT11.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpole(MaxId + 1)
        f.MdiParent = Me.ParentForm
        Select Case PoleState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() 'Dialog()
        '        If f.ShowDialog = Windows.Forms.DialogResult.OK Then Me.bt_find.PerformClick()
    End Sub

    Private Sub BT12olStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT12.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpolekiki(MaxId + 1)
        f.MdiParent = Me.ParentForm
        Select Case PoleEtcState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show()
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleCable(MaxId + 1)
        f.MdiParent = Me.ParentForm

        Select Case PoleState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() 'Dialog()
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleCableLabel(MaxId + 1)
        f.MdiParent = Me.ParentForm

        Select Case PoleState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() 'Dialog()
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleJJ(MaxId + 1)
        f.MdiParent = Me.ParentForm

        Select Case PoleState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() 'Dialog()
    End Sub

    Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
        Dim A() As DataRow = Me.IreaDataSet1.MainTable.Select(vbNullString, "ID desc")
        Dim MaxId As Integer
        Try
            MaxId = A(0)(0).ToString
        Catch ex As Exception
            MaxId = 0
        End Try
        Dim f As New AddEpoleCable2(MaxId + 1)
        f.MdiParent = Me.ParentForm

        Select Case PoleState.ToUpper    'picstate 는 ini 파일에 정의되어잇다
            Case "MAX"
                f.WindowState = FormWindowState.Maximized
            Case "MIN"
                f.WindowState = FormWindowState.Minimized
            Case Else
                f.WindowState = FormWindowState.Normal
        End Select
        f.Show() 'Dialog()
    End Sub
End Class