ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-02-03 18:12:41

ghitax
Member
Registered: 2016-02-03
Posts: 1

Sheet tab control change name, intercept event MouseLeftButtonDown

Hello
I want change name of sheet tab after click of mouse,
but how intercept  the click of mouse into tab name of worksheet???

I use vb .net 2015 with WPF

Dim GridCalco As New ReoGridControl()
        With GridCalco
            .Margin = New Thickness(10, 100, 10, 10)
            .Worksheets.Clear()
            '.sh
            AddHandler GridCalco.MouseDown, AddressOf GridMouseDown
            AddHandler GridCalco.MouseRightButtonDown, AddressOf GridMouseRightDown
            AddHandler GridCalco.WorksheetInserted, AddressOf WorkSheetInsert
            AddHandler GridCalco.MouseLeftButtonDown, AddressOf GridMouseLeftDown

        End With

Private Sub GridMouseLeftDown(sender As Object, e As EventArgs)
???? how intercept click into tab sheet name????
End Sub

Offline

#2 2016-02-04 11:34:18

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Sheet tab control change name, intercept event MouseLeftButtonDown

You can use Worksheet.CellMouseDown event to get mouse click event and use Worksheet.Name property to change the sheet name. Below code applies to all worksheets.
VB.NET:

For Each sheet In GridCalco.Worksheets
  AddHandler sheet.CellMouseDown, Sub(_s As Object, _e As EventArgs)
               Dim newName = InputBox("Please enter sheet name: ", "Rename", sheet.Name)
               If Not String.IsNullOrEmpty(newName) Then sheet.Name = newName
             End Sub
Next

Also: Don't use Worksheets.Clear method since it may makes exception happen if there is no worksheet included in a workbook.

Last edited by Jingwood (2016-02-04 11:38:15)

Offline

Board footer

Powered by FluxBB