Public Class Frm_nBunbae

    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_nbunbae", 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_nbunbae"
            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("잠시만 기다려주세요")

        ' CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me)
        '//프로필 관련

        '//공유데이터셋에 연결한다.
        Me.bs.DataSource = DSET1
        '//냉방분배
        AddHandler DSET1.tbl_nbunbae.TableNewRow, AddressOf AddNewDataRow_bunbae
        AddHandler DSET1.tbl_nbunbae.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 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

#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 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 Binding_Zone()

        '//냉방분배시스템
        Dim bs_생산기기구분 As New BindingSource(DSET1, "tbl_nanbangkiki")
        bs_생산기기구분.Sort = "code"
        Me.cmb_생산기기구분.DataSource = bs_생산기기구분
        cmb_생산기기구분.DisplayMember = "설명"
        cmb_생산기기구분.ValueMember = "code"
        Me.cmb_생산기기구분.DataBindings.Add("selectedvalue", Me.bs, "생산기기구분")
        'AddHandler cmb_생산기기구분.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_표준치적용 As New BindingSource(DSET1, "tbl_common")
        bs_표준치적용.Filter = "gubun='1080'"
        bs_표준치적용.Sort = "code"
        Me.cmb_표준치적용.DataSource = bs_표준치적용
        cmb_표준치적용.DisplayMember = "name"
        cmb_표준치적용.ValueMember = "name"
        Me.cmb_표준치적용.DataBindings.Add("selectedvalue", Me.bs, "표준치적용")
        'AddHandler cmb_표준치적용.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_배관망유형 As New BindingSource(DSET1, "tbl_common")
        bs_배관망유형.Filter = "gubun='1084'"
        bs_배관망유형.Sort = "code"
        Me.cmb_배관망유형.DataSource = bs_배관망유형
        cmb_배관망유형.DisplayMember = "name"
        cmb_배관망유형.ValueMember = "name"
        Me.cmb_배관망유형.DataBindings.Add("selectedvalue", Me.bs, "배관망유형")
        'AddHandler cmb_표준치적용.KeyDown, AddressOf Cmb_DeleteVal


        Dim bs_배관구간방식 As New BindingSource(DSET1, "tbl_common")
        bs_배관구간방식.Filter = "gubun='1081'"
        bs_배관구간방식.Sort = "code"
        Me.cmb_배관구간방식.DataSource = bs_배관구간방식
        cmb_배관구간방식.DisplayMember = "name"
        cmb_배관구간방식.ValueMember = "name"
        Me.cmb_배관구간방식.DataBindings.Add("selectedvalue", Me.bs, "배관구간방식")
        'AddHandler cmb_배관구간방식.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_배관설치장소 As New BindingSource(DSET1, "tbl_common")
        bs_배관설치장소.Filter = "gubun='1082'"
        bs_배관설치장소.Sort = "code"
        Me.cmb_배관설치장소.DataSource = bs_배관설치장소
        cmb_배관설치장소.DisplayMember = "name"
        cmb_배관설치장소.ValueMember = "name"
        Me.cmb_배관설치장소.DataBindings.Add("selectedvalue", Me.bs, "배관설치장소")
        'AddHandler cmb_배관설치장소.KeyDown, AddressOf Cmb_DeleteVal

        Dim bs_지관연결관장소 As New BindingSource(DSET1, "tbl_common")
        bs_지관연결관장소.Filter = "gubun='1083'"
        bs_지관연결관장소.Sort = "code"
        Me.cmb_지관연결관장소.DataSource = bs_지관연결관장소
        cmb_지관연결관장소.DisplayMember = "name"
        cmb_지관연결관장소.ValueMember = "name"
        Me.cmb_지관연결관장소.DataBindings.Add("selectedvalue", Me.bs, "지관장소")
        'AddHandler cmb_지관연결관장소.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 AddNewDataRow_bunbae(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
        e.Row.Item("code") = GetMaxCode(DSET1.tbl_nbunbae)
        e.Row.Item("설명") = "신규데이터"
        e.Row.Item("sortkey") = GetNewSortKey()
    End Sub

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

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

    End Function
#End Region

    Private Sub 냉동기ComboBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_생산기기구분.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) <> 17 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 + 2  '//사용프로필 앞에 두개를 숫자4자로변환
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_생산기기구분.SelectedIndex = 0
                            Else
                                Me.cmb_생산기기구분.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If

                            'Me.cmb_생산기기구분.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 1 + 2  '//공란
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_표준치적용.SelectedIndex = 0
                            Else
                                Me.cmb_표준치적용.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                        Case 2 + 2
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_배관망유형.SelectedIndex = 0
                            Else
                                Me.cmb_배관망유형.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If
                            ' Me.cmb_표준치적용.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 3 + 2 + 2
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_배관구간방식.SelectedIndex = 0
                            Else
                                Me.cmb_배관구간방식.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If

                            'Me.cmb_배관구간방식.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 4 + 2 + 2
                            Me.배관구간길이MyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 5 + 2 + 2
                            Me.열관류율MyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 6 + 2 + 2
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_배관설치장소.SelectedIndex = 0
                            Else
                                Me.cmb_배관설치장소.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If

                            'Me.cmb_배관설치장소.Text = CStr(IIf( CB(i).Split(CChar(vbTab))(ii).Trim = "", "0",  CB(i).Split(CChar(vbTab))(ii).Trim))
                        Case 8 + 2 + 2
                            Me.건물길이xMyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 9 + 2 + 2
                            Me.건물길이yMyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 10 + 2 + 2
                            Me.층수MyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 11 + 2 + 2
                            Me.층고MyTb.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                        Case 12 + 2 + 2
                            If CB(i).Split(CChar(vbTab))(ii).Trim = "" Then
                                Me.cmb_지관연결관장소.SelectedIndex = 0
                            Else
                                Me.cmb_지관연결관장소.Text = CB(i).Split(CChar(vbTab))(ii).Trim
                            End If

                            'Me.cmb_지관연결관장소.Text = CStr(IIf(CB(i).Trim = "", "0", CB(i).Trim))
                    End Select
                Next
            Next

            Me.bs.EndEdit()
        End If
    End Sub

    Private Sub Validate_Control()
        If Not Init Then Return
        'Try
        '    If Me.조명부하산출방법ComboBox.SelectedValue.ToString = "0001" Then   '//계산치
        '        Me.요구조도NTb1.Enabled = True
        '        Me.천장고NTB1.Enabled = True
        '        Me.작업면높이NTb1.Enabled = True
        '        Me.실깊이NTb.Enabled = True
        '        Me.실너비NTb.Enabled = True
        '        Me.실지수NTb1.Enabled = True
        '        Me.조명방식ComboBox.Enabled = True
        '        Me.인공광원ComboBox.Enabled = True
        '        Me.보수율NTb.Enabled = True
        '        'Me.점등시간NTb.Enabled = False
        '        Me.조명기기효율NTb.Enabled = True
        '        Me.조명률NTb.Enabled = True
        '        Me.조명에너지부하율계산치NTb.Enabled = True
        '        Me.조명에너지부하율입력치NTb.Enabled = False
        '    Else
        '        Me.요구조도NTb1.Enabled = False
        '        Me.천장고NTB1.Enabled = False
        '        Me.작업면높이NTb1.Enabled = False
        '        Me.실깊이NTb.Enabled = False
        '        Me.실너비NTb.Enabled = False
        '        Me.실지수NTb1.Enabled = False
        '        Me.조명방식ComboBox.Enabled = False
        '        Me.인공광원ComboBox.Enabled = False
        '        Me.보수율NTb.Enabled = False
        '        'Me.점등시간NTb.Enabled = False
        '        Me.조명기기효율NTb.Enabled = False
        '        Me.조명률NTb.Enabled = False
        '        Me.조명에너지부하율계산치NTb.Enabled = False
        '        Me.조명에너지부하율입력치NTb.Enabled = True
        '        'Me.점등시간TextBox.Enabled = True
        '    End If
        '    Me.bs.EndEdit()
        'Catch ex As Exception

        'End Try

        Try
            If Me.cmb_표준치적용.Text = "상세입력" Then
                열분배GroupBox.Enabled = True
                난방분배표준치GroupBox.Enabled = False
                열분배PictureBox.Enabled = True
                난방분배표준치PictureBox.Enabled = False
                If Me.cmb_배관망유형.Text = "급탕" Then
                    cmb_배관구간방식.Enabled = False
                    배관구간길이MyTb.Enabled = True
                    열관류율MyTb.Enabled = True
                    cmb_배관설치장소.Enabled = False
                ElseIf Me.cmb_배관망유형.Text = "난방" Then
                    cmb_배관구간방식.Enabled = True
                    배관구간길이MyTb.Enabled = True
                    열관류율MyTb.Enabled = True
                    cmb_배관설치장소.Enabled = True
                Else
                    cmb_배관구간방식.Enabled = False
                    배관구간길이MyTb.Enabled = False
                    열관류율MyTb.Enabled = False
                    cmb_배관설치장소.Enabled = False
                End If

            ElseIf Me.cmb_표준치적용.Text = "표준치조건" Then
                열분배GroupBox.Enabled = False
                열분배PictureBox.Enabled = False
                If Me.cmb_배관망유형.Text = "급탕" Then
                    난방분배표준치GroupBox.Enabled = False
                    난방분배표준치PictureBox.Enabled = False
                Else
                    난방분배표준치GroupBox.Enabled = True
                    난방분배표준치PictureBox.Enabled = True
                End If
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub SplitContainer1_Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles SplitContainer1.Panel1.Paint

    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_nbunbae.Select(Me.bs.Filter, "")
                For i As Integer = dR.GetUpperBound(0) To 0 Step -1
                    dR(i).Delete()
                Next
                DSET1.tbl_nbunbae.AcceptChanges()
            End If
        End If
    End Sub

    Private Sub cmb_배관망유형_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_배관망유형.SelectedIndexChanged
        Validate_Control()
    End Sub

    Private Sub cmb_표준치적용_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_표준치적용.SelectedIndexChanged
        Validate_Control()
    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 bs_CurrentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles bs.CurrentChanged
        If Not Init Then Return
        Me.bs.EndEdit()

        Dim drv As DataRowView = Me.bs.Current
        If drv Is Nothing Then Return
        Me.lb_code.Text = "[" + drv("code").ToString + "]"
    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