.net

vb net 스프레드 시트 keyup

몽키 D.루피 2016. 4. 7. 14:13

//실시간 검색

Private Sub FpS123_EditModeOn(sender As Object, e As EventArgs) Handles FpS123.EditModeOn


        Dim KeyPressHandler As KeyEventHandler = AddressOf FpS123_KeyUp

        AddHandler FpS123.EditingControl.KeyUp, KeyPressHandler



        With FpS123.ActiveSheet

            FpS123.Sheets(0).SetText(0, 1, .GetText(.ActiveRowIndex, .ActiveColumnIndex))

            'MessageBox.Show(.GetText(.ActiveRowIndex, .ActiveColumnIndex))

            ' Call test(.GetText(.ActiveRowIndex, .ActiveColumnIndex))

        End With


    End Sub


    Private Sub FpS123_EditModeOff(sender As Object, e As EventArgs) Handles FpS123.EditModeOff


        Dim edit_text


        Dim KeyPressHandler As KeyEventHandler = AddressOf FpS123_KeyUp

        RemoveHandler FpS123.EditingControl.KeyUp, KeyPressHandler

        edit_text = Split(sender.AccessibleDescription, ",")




        With FpS123.ActiveSheet


            FpS123.Sheets(0).SetText(0, 1, .GetText(.ActiveRowIndex, .ActiveColumnIndex))

            'MessageBox.Show(.GetText(.ActiveRowIndex, .ActiveColumnIndex))

            ' Call test(.GetText(.ActiveRowIndex, .ActiveColumnIndex))

        End With


    End Sub




    Private Sub FpS123_KeyUp(sender As Object, e As KeyEventArgs) Handles FpS123.KeyUp, FpS123.KeyDown


        If sender.ToString = "FarPoint.Win.Spread.CellType.GeneralEditor" Then


            'FarPoint.Win.Spread.CellType.GeneralEditor

            If e.KeyCode = Keys.Escape Then Exit Sub

            If e.KeyCode = Keys.Enter Then Exit Sub


            If e.KeyCode = Keys.Delete Then

                With FpS123.ActiveSheet

                    Select Case MsgBox("선택된 부분을 삭제하시겠습니까?", MsgBoxStyle.YesNo, "caption")

                        Case MsgBoxResult.Yes

                            ' MessageBox.Show("Yes button")

                            FpS123.Sheets(0).Rows.Remove(.ActiveRowIndex, 1)

                            sang_sprR = sang_sprR - 1

                        Case MsgBoxResult.No

                            'MessageBox.Show("NO button")

                    End Select

                End With

                Exit Sub

            End If


            Dim test_text As String

            test_text = sender.FormatText


            FpS123.Sheets(0).SetText(0, 2, test_text)


        End If


    End Sub