Public Class Frm_kongkub
    Dim Init As Boolean = False
    Dim SrcDrv As DataRowView
#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


    Public Sub New(_opentime)

        ' 이 호출은 디자이너에 필요합니다.
        InitializeComponent()
        OpenTime = _opentime

        ' InitializeComponent() 호출 뒤에 초기화 코드를 추가하십시오.


    End Sub
    Private Sub ShowHistory()
        Dim drv As DataRowView = Me.bs.Current
        Dim f As New Frm_History("tbl_kongkub", drv("code").ToString)
        If f.ShowDialog = DialogResult.OK Then
            drv(f.colname) = f.val
            Me.Validate()
            Me.bs.EndEdit()
            My.Application.DoEvents()
            MsgBox("값이 변경되었습니다", MsgBoxStyle.Information, "확인")
        End If
    End Sub
    Private Sub AddNewDataRow_Zone_Changed2(ByVal sender As Object, ByVal e As System.Data.DataColumnChangeEventArgs)
        Dim oval As String = e.Row(e.Column.ColumnName).ToString
        Dim nval As String = e.ProposedValue.ToString
        If oval <> nval Then
            Dim newdr As DS2.historyRow = DSHistory.history.NewhistoryRow
            newdr.time = Now.ToString("yyyy-MM-dd HH:mm:ss")
            newdr.tablename = "tbl_kongkub"
            newdr.ovalue = oval
            newdr.nvalue = nval
            newdr.column = e.Column.ColumnName
            newdr.code = e.Row("code").ToString
            DSHistory.history.AddhistoryRow(newdr)
            DSHistory.history.AcceptChanges()
        End If
    End Sub
    Private Sub MdiMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.Show()
        My.Application.DoEvents()
        'Work_msg_timer("잠시만 기다려주세요")


        '//공유데이터셋에 연결한다.
        Me.bs.DataSource = DSET1


        '//난방공급시스템
        AddHandler DSET1.tbl_kongkub.TableNewRow, AddressOf AddNewDataRow_kongkub
        AddHandler DSET1.tbl_kongkub.ColumnChanging, AddressOf AddNewDataRow_Zone_Changed2

        '//모든컨트롤의 cTrl_enter 를 추가합니다
        BindProperty(CType(Me.SplitContainer1.Panel2.Controls, Control.ControlCollection))

        '//콤보컨트롤 바인딩
        Binding_Zone()

        Me.bs.Filter = "code <> '0'"
        If Me.Parameter <> "" Then Me.bs.Filter &= " and 열공급시스템 ='" + Me.Parameter + "'"
        ' Me.lb_grpname.Text = Me.Parameter



        Me.Init = True

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

        bs_CurrentChanged(sender, e)
        Validate_control()
        AddDebug("▲ Form Load")
    End Sub
#Region "Control_Enter"
    Private Sub BindProperty(ByVal Ctl As Control.ControlCollection)
        For Each C As Control In Ctl
            If C.Controls.Count > 1 Then
                BindProperty(C.Controls)
            Else
                If C.GetType.ToString.ToUpper.IndexOf("MYTB") <> -1 Then
                    AddHandler CType(C, MyTb).KeyDown, AddressOf TextBOx_KeyDown
                ElseIf C.GetType.ToString.ToUpper.IndexOf("MYCMB") <> -1 Then
                    AddHandler CType(C, MyCmb).KeyDown, AddressOf Cmd_KeyDown
                End If
            End If
        Next
    End Sub


    Private Sub TextBOx_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter AndAlso e.Control Then
            Try
                Dim Field As String = (CType(sender, MyTb).DataBindings.Item("text").BindingMemberInfo.BindingField)
                For Each Dr As DataRow In dt.Select(Me.bs.Filter, "")
                    Dr(Field) = CType(sender, MyTb).Text
                Next
                Work_msg_timer("모든값이 변경되었습니다", 25)
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub Cmd_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter AndAlso e.Control Then
            Try
                Dim Field As String = (CType(sender, MyCmb).DataBindings.Item("selectedvalue").BindingMemberInfo.BindingField)
                For Each Dr As DataRow In dt.Select(Me.bs.Filter, "")
                    Dr(Field) = CType(sender, MyCmb).SelectedValue
                Next
                Work_msg_timer("모든값이 변경되었습니다", 25)
            Catch ex As Exception

            End Try
        End If
    End Sub
#End Region
#Region "난방공급시스템"

    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

#Region "제어버튼"
    Private Sub ToolStripButton48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_add.Click
        If Not EndEdit(Me.bs) Then Return
        Me.bs.AddNew()
        INitRow(Me.Controls)
        MdiMain.RefreshMenuList(TreeTag)
    End Sub


    Private Sub ToolStripButton49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Del.Click
        Dbbase.DelCrow(Me.bs, True)
        MdiMain.RefreshMenuList(TreeTag)
    End Sub

    Private Sub ToolStripButton51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_cancel.Click
        If Not EndEdit(Me.bs) Then Return
        Data_Cancel(DSET1.tbl_profile, Nothing)
        MdiMain.RefreshMenuList(TreeTag)
    End Sub

#End Region

    Private Sub Binding_Zone()

        '//난방공급 시스템
        Dim bs_열공급시스템ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_열공급시스템ComboBox.Filter = "gubun='1045'"
        bs_열공급시스템ComboBox.Sort = "code"
        Me.열공급시스템ComboBox.DataSource = bs_열공급시스템ComboBox
        열공급시스템ComboBox.DisplayMember = "name"
        열공급시스템ComboBox.ValueMember = "name"
        Me.열공급시스템ComboBox.DataBindings.Add("selectedvalue", Me.bs, "열공급시스템")
        ' AddHandler 열공급시스템ComboBox.KeyDown, AddressOf Cmb_DeleteVal



        Dim bs_열공급생산기기ComboBox As New BindingSource(DSET1, "tbl_nanbangkiki")
        Me.열공급생산기기ComboBox.DataSource = bs_열공급생산기기ComboBox
        bs_열공급생산기기ComboBox.Sort = "code"
        열공급생산기기ComboBox.DisplayMember = "설명"
        열공급생산기기ComboBox.ValueMember = "code"
        Me.열공급생산기기ComboBox.DataBindings.Add("selectedvalue", Me.bs, "열공급생산기기")
        ' AddHandler 열공급생산기기ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_노출형제어ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_노출형제어ComboBox.Filter = "gubun='1033'" '//비제어,onoff제어,pi제어
        bs_노출형제어ComboBox.Sort = "code"
        Me.노출형제어ComboBox.DataSource = bs_노출형제어ComboBox
        노출형제어ComboBox.DisplayMember = "name"
        노출형제어ComboBox.ValueMember = "name"
        Me.노출형제어ComboBox.DataBindings.Add("selectedvalue", Me.bs, "노출형제어")
        'AddHandler 노출형제어ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_바닥난방열제어ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_바닥난방열제어ComboBox.Filter = "gubun='1033'"
        bs_바닥난방열제어ComboBox.Sort = "code"
        Me.바닥난방열제어ComboBox.DataSource = bs_바닥난방열제어ComboBox
        바닥난방열제어ComboBox.DisplayMember = "name"
        바닥난방열제어ComboBox.ValueMember = "name"
        Me.바닥난방열제어ComboBox.DataBindings.Add("selectedvalue", Me.bs, "바닥난방열제어")
        'AddHandler 바닥난방열제어ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_바닥난방열건축부위ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_바닥난방열건축부위ComboBox.Filter = "gubun='1034'"
        bs_바닥난방열건축부위ComboBox.Sort = "code"
        Me.바닥난방열건축부위ComboBox.DataSource = bs_바닥난방열건축부위ComboBox
        바닥난방열건축부위ComboBox.DisplayMember = "name"
        바닥난방열건축부위ComboBox.ValueMember = "name"
        Me.바닥난방열건축부위ComboBox.DataBindings.Add("selectedvalue", Me.bs, "바닥난방열건축부위")
        'AddHandler 바닥난방열건축부위ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_바닥난방전기제어ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_바닥난방전기제어ComboBox.Filter = "gubun='1033'"  '//습식,건식,반건식
        bs_바닥난방전기제어ComboBox.Sort = "code"
        Me.바닥난방전기제어ComboBox.DataSource = bs_바닥난방전기제어ComboBox
        바닥난방전기제어ComboBox.DisplayMember = "name"
        바닥난방전기제어ComboBox.ValueMember = "name"
        Me.바닥난방전기제어ComboBox.DataBindings.Add("selectedvalue", Me.bs, "바닥난방전기제어")
        'AddHandler 바닥난방전기제어ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_바닥난방전기건축부위ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_바닥난방전기건축부위ComboBox.Filter = "gubun='1034'"
        bs_바닥난방전기건축부위ComboBox.Sort = "code"
        Me.바닥난방전기건축부위ComboBox.DataSource = bs_바닥난방전기건축부위ComboBox
        바닥난방전기건축부위ComboBox.DisplayMember = "name"
        바닥난방전기건축부위ComboBox.ValueMember = "name"
        Me.바닥난방전기건축부위ComboBox.DataBindings.Add("selectedvalue", Me.bs, "바닥난방전기건축부위")
        ' AddHandler 바닥난방전기건축부위ComboBox.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_전기난방제어ComboBox As New BindingSource(DSET1, "tbl_common")
        bs_전기난방제어ComboBox.Filter = "gubun='1033'"
        bs_전기난방제어ComboBox.Sort = "code"
        Me.전기난방제어ComboBox.DataSource = bs_전기난방제어ComboBox
        전기난방제어ComboBox.DisplayMember = "name"
        전기난방제어ComboBox.ValueMember = "name"
        Me.전기난방제어ComboBox.DataBindings.Add("selectedvalue", Me.bs, "전기난방제어")
        'AddHandler 전기난방제어ComboBox.KeyDown, AddressOf Cmb_DeleteVal
    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 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
                ShowHistory()
        End Select
    End Sub
    Private Sub AddNewDataRow_kongkub(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("code") = GetMaxCode(DSET1.tbl_kongkub)
        e.Row.Item("설명") = "신규데이터"
        e.Row.Item("sortkey") = GetNewSortKey()
    End Sub

    Private Function GetNewSortKey() As String
        AddDebug("GetNewSortKey")

        Dim drows() As DS.tbl_kongkubRow = DSET1.tbl_kongkub.Select("code <> '0'", "sortkey desc")
        If drows.Length < 1 Then Return 1
        Dim Dr As DS.tbl_kongkubRow = drows(0)
        Dim maxsortkey As Integer = Dr.sortkey
        Return maxsortkey + 1

    End Function

#End Region

    Private Sub bs_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bs.CurrentChanged
        If Not Init Then Return
        Try
            Dim drv As DataRowView = Me.bs.Current
            If drv Is Nothing Then Return
            Me.lb_code.Text = "[" + drv("code").ToString + "]"

            Dim DR() As DataRow = DSET1.tbl_zone.Select("냉난방열공급시스템='" & drv("code").ToString & "'")

            '====================================================================2014.05.07 추가
            If DR.GetUpperBound(0) = -1 Then
                Me.tb_zone_cnt.Text = "0"
            Else
                Dim 존수 As Integer = 0
                For Each drow As DS.tbl_zoneRow In DR
                    If IsNumeric(drow.입력존의수) Then
                        존수 += CInt(drow.입력존의수)
                    Else
                        존수 += 1
                    End If
                    '존수 += TOSG(drow.입력존의수)
                Next
                Me.tb_zone_cnt.Text = 존수.ToString
            End If
            'Me.tb_zone_cnt.Text = CStr(DR.GetUpperBound(0) + 1)
            '====================================================================2014.05.07 추가
        Catch ex As Exception
            Me.tb_zone_cnt.Text = "0"
        End Try
        Me.bs.EndEdit()

    End Sub

    Private Sub 열공급시스템ComboBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles 열공급시스템ComboBox.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) <> 21 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() '//한줄추가

                Dim Cnt As Short = 0
                For i As Integer = 0 To CB.GetUpperBound(0)
                    Select Case i
                        Case 0
                            CType(bs.Current, DataRowView)("설명") = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 0 + 3  '//사용프로필 앞에 두개를 숫자4자로변환
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.열공급시스템ComboBox.SelectedIndex = 0
                            Else
                                Me.열공급시스템ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            'Me.열공급시스템ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 1 + 3 '//공란
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.열공급생산기기ComboBox.SelectedIndex = 0
                            Else
                                Me.열공급생산기기ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            'Me.열공급생산기기ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 3 + 3  '//면적
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.노출형제어ComboBox.SelectedIndex = 0
                            Else
                                Me.노출형제어ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            ' Me.노출형제어ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 5 + 3
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.바닥난방열제어ComboBox.SelectedIndex = 0
                            Else
                                Me.바닥난방열제어ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            ' Me.바닥난방열제어ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 6 + 3
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.바닥난방열건축부위ComboBox.SelectedIndex = 0
                            Else
                                Me.바닥난방열건축부위ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            ' Me.바닥난방열건축부위ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 8 + 3
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.바닥난방전기제어ComboBox.SelectedIndex = 0
                            Else
                                Me.바닥난방전기제어ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            'Me.바닥난방전기제어ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 9 + 3
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.바닥난방전기건축부위ComboBox.SelectedIndex = 0
                            Else
                                Me.바닥난방전기건축부위ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            ' Me.바닥난방전기건축부위ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 11 + 3
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.전기난방제어ComboBox.SelectedIndex = 0
                            Else
                                Me.전기난방제어ComboBox.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            'Me.전기난방제어ComboBox.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 13 + 3
                            'Me.TabControl18.SelectedIndex = 1
                            Me.제어기의정격전력NTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 14 + 3
                            Me.팬송풍기정격전력NTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 15 + 3
                            Me.펌프정격전력NTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 16 + 3
                            Me.팬송풍기수NTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 17 + 3
                            Me.추가펌프수NTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim

                    End Select
                Next
            Next

            Me.bs.EndEdit()
        End If
    End Sub


    Private Sub bt_Del_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles bt_Del.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Right Then
            If MsgBox("전체삭제를 하시겠습니까?", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "확인") = MsgBoxResult.Ok Then
                Dim dR() As DataRow = DSET1.tbl_kongkub.Select(Me.bs.Filter, "")
                For i As Integer = dR.GetUpperBound(0) To 0 Step -1
                    dR(i).Delete()
                Next
                DSET1.tbl_kongkub.AcceptChanges()
            End If
        End If
    End Sub

    Private Sub 열공급시스템ComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 열공급시스템ComboBox.SelectedIndexChanged
        VALIDATE_CONTROL()
    End Sub

    Private Sub Validate_control()
        If Not Init Then Return
        Try
            Select Case 열공급시스템ComboBox.Text
                Case "노출형방열기(열)"
                    열공급생산기기ComboBox.Enabled = True
                    노출형방열기GroupBox.Enabled = True
                    바닥난방열GroupBox.Enabled = False
                    전기난방GroupBox.Enabled = False
                    바닥난방전기GroupBox.Enabled = False

                Case "바닥난방(열)"
                    열공급생산기기ComboBox.Enabled = True
                    노출형방열기GroupBox.Enabled = False
                    바닥난방열GroupBox.Enabled = True
                    전기난방GroupBox.Enabled = False
                    바닥난방전기GroupBox.Enabled = False

                Case "전기난방"
                    열공급생산기기ComboBox.Enabled = False
                    노출형방열기GroupBox.Enabled = False
                    바닥난방열GroupBox.Enabled = False
                    전기난방GroupBox.Enabled = True
                    바닥난방전기GroupBox.Enabled = False

                Case "바닥난방(전기)"
                    열공급생산기기ComboBox.Enabled = False
                    노출형방열기GroupBox.Enabled = False
                    바닥난방열GroupBox.Enabled = False
                    전기난방GroupBox.Enabled = False
                    바닥난방전기GroupBox.Enabled = True

                Case Else
                    열공급생산기기ComboBox.Enabled = False
                    노출형방열기GroupBox.Enabled = False
                    바닥난방열GroupBox.Enabled = False
                    전기난방GroupBox.Enabled = False
                    바닥난방전기GroupBox.Enabled = False

            End Select
        Catch ex As Exception

        End Try
    End Sub

    Private Sub dv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dv.MouseUp
        If Prj.UserAuthType = "ADMIN" OrElse Prj.UserAuthType = "BOTH" OrElse Prj.UserAuthType = "BOTH2" OrElse Prj.UserAuthType = "BOTH1" Then  '//2011.03.08 추가
            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 = "열공급생산기기"
                Frm_FilterA.Numfield = ""    '//20100618  Color 리스트처럼 , 구분해서 필드들을 모두 넣으세요.(=, >= 등을 사용하기 위해서는 해당 항목을 추가 요망)
                Frm_FilterA.Default_Filter = "code <> '0'"

                If Frm_FilterA.ShowDialog <> Windows.Forms.DialogResult.OK Then Return '//창떳을떄 확인아ㅣ고 취소눌르면 다음을 수행하지않는다는거에요.
                Dim Filter As String = Frm_FilterA.tb_filter.Text   '//값은 아까 그 텍박에 잇구요.
                Try
                    Me.bs.Filter = Filter

                    '//바꾸기값이 있으면 변경 20100618
                    If Frm_FilterA.cmb_fieldc.SelectedIndex >= 0 AndAlso Frm_FilterA.cmb_fieldc.Text.ToLower <> "code" AndAlso _
                    Frm_FilterA.tb_valuec.Text <> "" Then
                        Dim Drow() As DataRow = Me.dt.Select(Filter)
                        For Each Dr As DataRow In Drow
                            Dr(Frm_FilterA.cmb_fieldc.Text) = Frm_FilterA.tb_valuec.Text
                        Next
                        MsgBox("바꾸기 완료", MsgBoxStyle.Information, "확인")
                    End If

                Catch ex As Exception
                    Me.bs.Filter = ""
                End Try
            End If
        End If
    End Sub
    Private Sub dv_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dv.KeyDown
        '//여기보시면   alt+d 누르면  한줄을 경고없이(falsE)삭제하도록 햇어요.. 사실원래 밋alt +d 인데.. ㅎㅎ 잘못해서 ctrl 됫다는
        If Prj.UserAuthType = "ADMIN" OrElse Prj.UserAuthType = "BOTH" OrElse Prj.UserAuthType = "BOTH2" OrElse Prj.UserAuthType = "BOTH1" Then  '//2011.03.08 추가
            Select Case e.KeyCode
                Case Keys.D
                    If e.Alt Then
                        Dbbase.DelCrow(Me.bs, False)
                    End If
                Case Keys.C
                    If e.Control Then
                        Me.SrcDrv = Me.bs.Current
                        If Me.SrcDrv Is Nothing Then
                            MsgBox("저장할 ROW가 없습니다", MsgBoxStyle.Information, "확인")
                            Return
                        End If
                        ' My.Computer.Clipboard.SetData("ZDATA", Drv)
                    End If
                Case Keys.V
                    If e.Control Then
                        If Me.SrcDrv Is Nothing Then Return
                        Me.bt_add.PerformClick()  '//신규추가
                        Dim NewDrv As DataRowView = Me.bs.Current

                        For Each C As DataColumn In Me.dt.Columns
                            If C.ColumnName.ToUpper = "CODE" Then
                            ElseIf C.ColumnName.ToUpper = "설명" Then
                                NewDrv(C.ColumnName) = SrcDrv(C.ColumnName) & "#1"
                            Else
                                NewDrv(C.ColumnName) = SrcDrv(C.ColumnName)
                            End If
                        Next
                        Me.bs.EndEdit()
                        bs.MoveLast()
                    End If
            End Select
        End If
    End Sub

    Private Sub dv_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv.CellContentClick

    End Sub

End Class