Public Class Frm_V20091231_Weather
#Region "data Base 변경여부및 적용방법"

    '''변경된내용을적용한다.
    Public Overrides Function AcceptChanged() As Boolean
        bs.EndEdit()
        Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
        Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
        BaseDT.AcceptChanges()
        Return True
    End Function

    '''변경된내용이있다면 취소한다.
    Public Overrides Function RejectChanged() As Boolean
        Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
        Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
        BaseDT.RejectChanges()
        Return True
    End Function

    '''데이터에변형이있었는가?
    Public Overrides Function HasChanged() As Boolean
        bs.EndEdit()
        Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
        Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
        Dim ChangeDT As DataTable = BaseDT.GetChanges
        If Not ChangeDT Is Nothing Then Return True
        Return False
    End Function

    '''기본데이터테이블을 반환합니다.
    Public Function DT() As DataTable
        Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
        Return BaseDS.Tables(bs.DataMember)
    End Function


#End Region



    Private Sub MdiMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me, Me.bs.Position, True)
    End Sub

    Private Sub MdiMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.F12
        End Select
    End Sub

    Private Sub MdiMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'MdiMain.Toggle_Menu_Color(MdiMain.E_MenuIdx.기상데이터)
        'CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me)
        '//Weatehr
        AddHandler DSET.tbl_weather.TableNewRow, AddressOf AddNewDataRow_Weather

        AddHandler DSET.weather_ilsa.TableNewRow, AddressOf AddNewDataRow_Weatherilsa
        AddHandler DSET.weather_supdo.TableNewRow, AddressOf AddNewDataRow_Weathersupdo
        AddHandler DSET.weather_temp.TableNewRow, AddressOf AddNewDataRow_Weathertemp
        AddHandler DSET.weather_cha.TableNewRow, AddressOf AddNewDataRow_WeatherCha

        Me.bs.DataSource = DSET
        Me.bsw_ilsa.DataSource = DSET
        Me.bsw_supdo.DataSource = DSET
        Me.bsw_temp.DataSource = DSET
        Me.bsw_cha.DataSource = DSET

        '//콤보컨트롤 바인딩
        Me.bn_all.BindingSource = Me.bs
        Me.bs = Me.bs

        Try
            Me.bs.Position = CEnergy.ARINCLASS.Read_LastPos_Frm(Me)
        Catch ex As Exception
            Me.bs.MoveFirst()
        End Try

    End Sub

#Region "Weather 관련"
    Private Sub AddNewDataRow_Weather(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("code") = GetMaxCode(DSET.tbl_weather)
    End Sub
    Private Sub AddNewDataRow_Weatherilsa(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code")

        '//일사데이터는 0001로부터하게한다
        Dim Newcode As String
        Try
            Dim Dr As DataRow = DSET.weather_ilsa.Select("pcode='" & e.Row.Item("pcode").ToString & "'", "code desc")(0)
            Newcode = Format(CInt(Dr("code")) + 1, "0000")
        Catch ex As Exception
            Newcode = "0001"
        End Try

        e.Row.Item("code") = Newcode
    End Sub
    Private Sub AddNewDataRow_Weathertemp(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code")
        e.Row.Item("code") = GetMaxCode(DSET.weather_temp)
    End Sub
    Private Sub AddNewDataRow_Weathersupdo(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code")
        e.Row.Item("code") = GetMaxCode(DSET.weather_supdo)
    End Sub
    Private Sub AddNewDataRow_WeatherCha(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code")
        e.Row.Item("code") = GetMaxCode(DSET.weather_cha)
    End Sub
    Private Function GetMaxCode(ByVal dt As DataTable) As String
        Try
            Dim Dr As DataRow = dt.Select("", "code desc")(0)
            Return Format(CInt(Dr("code")) + 1, "0000")
        Catch ex As Exception
            Return "0001"
        End Try
    End Function

    Private Sub bt_add_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If Not EndEdit(Me.bs) Then Return
        Me.bs.AddNew()
    End Sub

    Private Sub bt_Del_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dbbase.DelCrow(Me.bs, True)
    End Sub

    Private Sub bt_save_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If Not EndEdit(Me.bs) Then Return
        If Not EndEdit(Me.bsw_supdo) Then Return
        If Not EndEdit(Me.bsw_ilsa) Then Return
        If Not EndEdit(Me.bsw_temp) Then Return
        If Not EndEdit(Me.bsw_cha) Then Return
        Check_Modify(Me.DS.tbl_weather)
        Check_Modify(Me.DS.weather_ilsa, False)
        Check_Modify(Me.DS.weather_supdo, False)
        Check_Modify(Me.DS.weather_temp, False)
        Check_Modify(Me.DS.weather_cha, False)

    End Sub

    Private Sub bs_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bs.CurrentChanged
        Dim pcode As String = CType(bs.Current, DataRowView)("code").ToString
        Me.bsw_ilsa.Filter = "pcode='" & pcode & "'"
        Me.bsw_temp.Filter = "pcode='" & pcode & "'"
        Me.bsw_supdo.Filter = "pcode='" & pcode & "'"
        Me.bsw_cha.Filter = "pcode='" & pcode & "'"

        If DSET.weather_temp.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then
            For i As Integer = 1 To 12
                'MsgBox(i)
                Dim Dr As DS.weather_tempRow = DSET.weather_temp.Newweather_tempRow
                Dr.code = Format(i, "0000")
                Dr.설명 = Format(i, "00") & "월"
                DSET.weather_temp.Addweather_tempRow(Dr)
            Next
        Else
            'MsgBox(Me.bsw_temp.Count)
        End If
        If DSET.weather_supdo.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then
            For i As Integer = 1 To 12
                Dim Dr As DS.weather_supdoRow = DSET.weather_supdo.Newweather_supdoRow
                Dr.code = Format(i, "0000")
                Dr.설명 = Format(i, "00") & "월"
                DSET.weather_supdo.Addweather_supdoRow(Dr)
            Next
        Else
            'MsgBox(Me.bsw_supdo.Count)
        End If
        Me.DS.weather_temp.AcceptChanges()
        Me.DS.weather_supdo.AcceptChanges()
    End Sub



    Private Sub ToolStripButton14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton14.Click
        If Not EndEdit(Me.bsw_ilsa) Then Return
        Me.bsw_ilsa.AddNew()
    End Sub

    Private Sub ToolStripButton15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton15.Click
        Dbbase.DelCrow(Me.bsw_ilsa, True)
    End Sub

    Private Sub ToolStripButton29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton29.Click
        If Not EndEdit(Me.bsw_temp) Then Return
        Me.bsw_temp.AddNew()
    End Sub

    Private Sub ToolStripButton30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton30.Click
        Dbbase.DelCrow(Me.bsw_temp, True)
    End Sub

    Private Sub ToolStripButton37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton37.Click
        If Not EndEdit(Me.bsw_supdo) Then Return
        Me.bsw_supdo.AddNew()
    End Sub

    Private Sub ToolStripButton38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton38.Click
        Dbbase.DelCrow(Me.bsw_supdo, True)
    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        Dbbase.DelCrow(Me.bsw_cha, True)
    End Sub

    Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
        If Not EndEdit(Me.bsw_cha) Then Return
        Me.bsw_cha.AddNew()
    End Sub

#End Region


    Private Sub ToolStripButton48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton48.Click
        If Prj.Opened = False Then
            MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인")
            Return
        End If
        If Not EndEdit(Me.bs) Then Return
        Me.bs.AddNew()
    End Sub

    Private Sub ToolStripButton49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton49.Click
        If Prj.Opened = False Then
            MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인")
            Return
        End If
        Dbbase.DelCrow(Me.bs, True)
    End Sub

    Private Sub ToolStripButton51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton51.Click
        If Prj.Opened = False Then
            MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인")
            Return
        End If

        If MsgBox("변경된 내용을 취소하시겠습니까?", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "변경취소") <> MsgBoxResult.Ok Then Return

        DSET.tbl_weather.RejectChanges()
        DSET.weather_cha.RejectChanges()
        DSET.weather_ilsa.RejectChanges()
        DSET.weather_supdo.RejectChanges()
        DSET.weather_temp.RejectChanges()

    End Sub

    Private Sub tb_t1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_t1.KeyDown
        'If e.KeyCode = Keys.V And e.Control Then
        '    e.Handled = True
        '    e.SuppressKeyPress = False
        '    '//클립보드붙여넣기
        '    Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
        '    Dim Cnt As Short = 0
        '    For i As Integer = 0 To CB.GetUpperBound(0)
        '        If CB(i).Trim <> "" Then
        '            If Cnt <> 0 Then
        '                Dim Ctl As TextBox = CType(Me.TableLayoutPanel3.Controls(Me.TableLayoutPanel3.Controls.IndexOfKey("tb_t" & CStr(Cnt + 1))), TextBox)
        '                Ctl.Text = CB(i).Trim
        '            End If
        '            Cnt = CShort(Cnt + 1)
        '        End If
        '    Next

        'End If
        If e.KeyCode = Keys.V And e.Control Then

            e.Handled = True
            e.SuppressKeyPress = False
            '//클립보드붙여넣기
            Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
            If CB.GetUpperBound(0) < 23 Then
                MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인")
                Return
            End If


            For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0)

                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0
                            '//Me.tb_t1.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 1
                            Me.tb_t2.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 2
                            Me.tb_t3.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 3
                            Me.tb_t4.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 4
                            Me.tb_t5.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5
                            Me.tb_t6.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6
                            Me.tb_t7.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 7
                            Me.tb_t8.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 8
                            Me.tb_t9.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9
                            Me.tb_t10.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10
                            Me.tb_t11.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11
                            Me.tb_t12.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 12
                            Me.tb_t13.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 13
                            Me.tb_t14.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 14
                            Me.tb_t15.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 15
                            Me.tb_t16.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 16
                            Me.tb_t17.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 17
                            Me.tb_t18.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 18
                            Me.tb_t19.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 19
                            Me.tb_t20.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 20
                            Me.tb_t21.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 21
                            Me.tb_t22.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 22
                            Me.tb_t23.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 23
                            Me.tb_t24.Text = CB(i).Split(CChar(vbTab))(ii).Trim

                    End Select
                Next
                '//If bsw_temp.Position < bsw_temp.Count Then bsw_temp.Position += 1 '//위치이동
            Next
            Me.bsw_temp.EndEdit()
        End If

    End Sub


    Private Sub tb_s1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_s1.KeyDown
        'If e.KeyCode = Keys.V And e.Control Then
        '    e.Handled = True
        '    e.SuppressKeyPress = False
        '    '//클립보드붙여넣기
        '    Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
        '    Dim Cnt As Short = 0
        '    For i As Integer = 0 To CB.GetUpperBound(0)
        '        If CB(i).Trim <> "" Then
        '            If Cnt <> 0 Then
        '                Dim Ctl As TextBox = CType(Me.TableLayoutPanel7.Controls(Me.TableLayoutPanel7.Controls.IndexOfKey("tb_s" & CStr(Cnt + 1))), TextBox)
        '                Ctl.Text = CB(i).Trim
        '            End If
        '            Cnt = CShort(Cnt + 1)
        '        End If
        '    Next

        'End If
        If e.KeyCode = Keys.V And e.Control Then

            e.Handled = True
            e.SuppressKeyPress = False
            '//클립보드붙여넣기
            Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
            If CB.GetUpperBound(0) < 23 Then
                MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인")
                Return
            End If


            For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0)

                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0
                            '//Me.tb_s1.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 1
                            Me.tb_s2.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 2
                            Me.tb_s3.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 3
                            Me.tb_s4.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 4
                            Me.tb_s5.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5
                            Me.tb_s6.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6
                            Me.tb_s7.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 7
                            Me.tb_s8.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 8
                            Me.tb_s9.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9
                            Me.tb_s10.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10
                            Me.tb_s11.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11
                            Me.tb_S12.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 12
                            Me.tb_s13.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 13
                            Me.tb_s14.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 14
                            Me.tb_s15.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 15
                            Me.tb_s16.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 16
                            Me.tb_s17.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 17
                            Me.tb_s18.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 18
                            Me.tb_s19.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 19
                            Me.tb_s20.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 20
                            Me.tb_s21.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 21
                            Me.tb_s22.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 22
                            Me.tb_s23.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 23
                            Me.tb_s24.Text = CB(i).Split(CChar(vbTab))(ii).Trim

                    End Select
                Next
                '//If bsw_supdo.Position < bsw_supdo.Count Then bsw_supdo.Position += 1 '//위치이동
            Next
            Me.bsw_supdo.EndEdit()
        End If

    End Sub

    Private Sub tb_v0_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_v0.KeyDown
        'If e.KeyCode = Keys.V And e.Control Then
        '    '//클립보드붙여넣기
        '    Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
        '    Dim Cnt As Short = 0
        '    For i As Integer = 0 To CB.GetUpperBound(0)
        '        If CB(i).Trim <> "" Then
        '            If Cnt <> 0 Then
        '                Dim Ctl As TextBox = CType(Me.TableLayoutPanel2.Controls(Me.TableLayoutPanel2.Controls.IndexOfKey("tb_v" & CStr(Cnt))), TextBox)
        '                Ctl.Text = CB(i).Trim
        '            End If
        '            Cnt = CShort(Cnt + 1)
        '        End If
        '    Next
        '    e.Handled = True
        '    e.SuppressKeyPress = False
        'End If


        Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
        If CB.GetUpperBound(0) < 12 Then
            MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인")
            Return
        End If

        If e.KeyCode = Keys.V And e.Control Then

            e.Handled = True
            e.SuppressKeyPress = False
            '//클립보드붙여넣기
            For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0)
                'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가
                'MsgBox(CB.GetUpperBound(0))
                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            '//Me.tb_v0.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 1  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v1.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 2  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v2.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 3  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v3.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 4  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v4.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v5.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v6.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 7  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v7.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 8  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v8.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v9.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v10.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v11.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_v12.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                    End Select
                Next
                '// If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동
            Next
            Me.bsw_ilsa.EndEdit()
        End If


    End Sub

    Private Sub Frm_V20091231_Zone_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
        If e.Delta < 0 Then
            If Me.bs.Position < Me.bs.Count Then Me.bs.Position += 1
        Else
            If Me.bs.Position > 0 Then Me.bs.Position -= 1
        End If
        Me.Validate()
        My.Application.DoEvents()
    End Sub

    Private Sub NTb4_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_c01.KeyDown
        If e.KeyCode = Keys.V And e.Control Then

            e.Handled = True
            e.SuppressKeyPress = False
            '//클립보드붙여넣기
            Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
            If CB.GetUpperBound(0) < 11 Then
                MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인")
                Return
            End If


            For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0)
                'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가

                'MsgBox(CB.GetUpperBound(0))

                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            '//Me.tb_c01.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 1  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c02.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 2  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c03.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 3  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c04.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 4  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c05.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c06.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c07.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 7  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c08.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 8  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c09.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c10.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c11.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_c12.Text = CB(i).Split(CChar(vbTab))(ii).Trim

                    End Select
                Next
                '//If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동
            Next
            Me.bsw_cha.EndEdit()
        End If
    End Sub


    Private Sub dv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dv.MouseUp
        If e.Button = Windows.Forms.MouseButtons.Right Then
            Dim Frm_FilterA As New Frm_Filter
            Frm_FilterA.ColumTitle = getColCaption(Me.Dt)
            Frm_FilterA.ColumList = getColName(Me.Dt)
            Frm_FilterA.Colorlist = ""
            If Frm_FilterA.ShowDialog <> Windows.Forms.DialogResult.OK Then Return '//창떳을떄 확인아ㅣ고 취소눌르면 다음을 수행하지않는다는거에요.
            Dim Filter As String = Frm_FilterA.tb_filter.Text   '//값은 아까 그 텍박에 잇구요.
            Try
                Me.bs.Filter = Filter
            Catch ex As Exception
                Me.bs.Filter = ""
            End Try
        End If
    End Sub

    Private Sub 외기온도_난방기_NTb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_wnan.KeyDown
        If e.KeyCode = Keys.V And e.Control Then

            e.Handled = True
            e.SuppressKeyPress = False
            '//클립보드붙여넣기
            Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf))
            If CB.GetUpperBound(0) < 14 Then
                MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인")
                Return
            End If

            For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0)
                'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가
                'MsgBox(CB.GetUpperBound(0))

                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            'Me.tb_wnan.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 1  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_wnaen.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 2  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            'Me.tb_c03.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 3  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w01.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 4  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w02.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w03.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w04.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 7  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w05.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 8  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w06.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w07.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10  '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w08.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w09.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w10.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 13 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w11.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 14 '///조명은 신규기록하지않으므로.. 쓰지않게한다.
                            Me.tb_w12.Text = CB(i).Split(CChar(vbTab))(ii).Trim

                    End Select
                Next
                If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동
            Next
            Me.bsw_cha.EndEdit()
        End If
    End Sub


    Private Sub Arindv2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Arindv2.KeyDown
        If e.KeyCode = Keys.C AndAlso e.Control Then

            My.Computer.Clipboard.SetData("ILSAROW", Me.Arindv2.SelectedRows)
        ElseIf e.KeyCode = Keys.V AndAlso e.Control Then
            Dim A As DataGridViewSelectedRowCollection = My.Computer.Clipboard.GetData("ILSAROW")
            For i As Integer = 1 To A.Count
                Me.ToolStripButton14.PerformClick()   '//한줄추가하고
                Dim Drv As DataRowView = Me.bsw_ilsa.Current
                Drv("설명") = A(i).Cells(0).Value
            Next
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        For Each drp As DS.tbl_weatherRow In DSET.tbl_weather.Rows
            Dim i As Integer = 0
            For Each dr As DS.weather_chaRow In DSET.weather_cha.Select("pcode='" & drp.code & "'")
                i += 1
                dr.code = Format(i, "0000")
            Next
        Next

        'For j As Integer = 1 To DSET.weather_cha.Select(Me.bsw_cha.Filter).Length
        '    DSET.weather_cha.Select(Me.bsw_cha.Filter)(j - 1)("code") = Format(j, "0000")
        'Next
        DS.weather_cha.AcceptChanges() '//이건 변경내역을 반영하게삳는겁니다.
    End Sub
End Class