Grid Desktop Checkbox

We have downloaded your latest evaluation version of Grid Desktop. We have encountered a number of problems with your checkbox cell control.

We add 2 columns of checkboxes, then we check or uncheck the check boxes using a mouse. When we iterate through the rows, all of the checkboxes are shown to be true even though many of them are not checked.

We have created the checkbox columns in 2 ways during form_load:

1)

gridDesktop1.GetActiveWorksheet().Columns(0).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(1).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(2).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(3).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)
gridDesktop1.GetActiveWorksheet().Columns(4).Width = 50
gridDesktop1.GetActiveWorksheet().Columns(5).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(6).Width = 50
gridDesktop1.GetActiveWorksheet().Columns(7).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(7).AddCheckBox(False)
gridDesktop1.GetActiveWorksheet().Columns(8).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(9).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(10).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(11).Width = 50


2)

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

Originally we added a cellrange to the checkbox columns, but then removed them.

We iterate the rows as follows:

Dim thisRound As Aspose.Cells.GridDesktop.Worksheet = gridDesktop1.GetActiveWorksheet()
Dim thisSheetIndex As Integer = gridDesktop1.ActiveSheetIndex
Dim nextSheetIndex As Integer = gridDesktop1.ActiveSheetIndex + 1
Dim nextRound As Aspose.Cells.GridDesktop.Worksheet = gridDesktop1.Worksheets(nextSheetIndex)
Dim i As Integer
Dim ii, iii As Integer
Dim r As Integer
Dim myResult As Integer

Other code…



Else 'Here is where we begin with the checkboxes

For r = 0 To 35

Dim chk1 As Aspose.Cells.GridDesktop.CheckBox = CType(gridDesktop1.GetActiveWorksheet().Controls(r, 3), Aspose.Cells.GridDesktop.CheckBox)
Dim chk2 As Aspose.Cells.GridDesktop.CheckBox = CType(gridDesktop1.GetActiveWorksheet().Controls(r, 7), Aspose.Cells.GridDesktop.CheckBox)

If chk1.Checked = False And chk2.Checked = False Then
Exit Sub
End If

myResult = iii Mod 2

If myResult = 0 Then

If chk1.Checked Then

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Red)
nextRound.Cells(i, 2).SetFontColor(Color.Red)
Else

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Black)
nextRound.Cells(i, 2).SetFontColor(Color.Black)

End If
i = i + 1
Else
If chk1.Checked Then

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Red)
nextRound.Cells(ii, 10).SetFontColor(Color.Red)

Else

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Black)
nextRound.Cells(ii, 10).SetFontColor(Color.Black)

End If
ii = ii + 1
End If
iii = iii + 1
Next
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim sheet As Worksheet = nextRound
sheet.SetFocusedCell(0, 0)

How do we force the correct values from the checkboxes?

Problem #2:

When we save to a workbook, no matter which version, the checkbox columns end up as 1’s and 0’s, which is ok, but, when we import the same worksheet into grid desktop, the checkboxes are removed and replaced with 1’s and 0’s. Is this by design, or are we doing something wrong?

Problem #3:

How can we programmatically select a different worksheet in grid desktop?

Thank you

Hi,

rgr:

We add 2 columns of checkboxes, then we check or uncheck the check boxes using a mouse. When we iterate through the rows, all of the checkboxes are shown to be true even though many of them are not checked.

1)

gridDesktop1.GetActiveWorksheet().Columns(0).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(1).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(2).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(3).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)
gridDesktop1.GetActiveWorksheet().Columns(4).Width = 50
gridDesktop1.GetActiveWorksheet().Columns(5).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(6).Width = 50
gridDesktop1.GetActiveWorksheet().Columns(7).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(7).AddCheckBox(False)
gridDesktop1.GetActiveWorksheet().Columns(8).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(9).Width = 20
gridDesktop1.GetActiveWorksheet().Columns(10).Width = 100
gridDesktop1.GetActiveWorksheet().Columns(11).Width = 50

I have tested your sample code with v2.7.13.xxx (Aspose.Cells.GridDesktop), it works fine and I do not find any issue. When I check or uncheck the check boxes using a mouse. When we iterate through the rows, all of the checkboxes are shown as not true, so they are rendered accordingly. Could you elaborate it or give me steps involved on how to reproduce the issue. You may preferably create a sample project (with v2.7.13.xxxx), zip it and post it here to reproduce the issue on our end. We will check it soon.

rgr:
2)

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

Originally we added a cellrange to the checkbox columns, but then removed them.

We iterate the rows as follows:
'.................

How do we force the correct values from the checkboxes?

I am not sure about this issue, could you give us more details and create a sample project (with v2.7.13.xxxx), zip it and post it here to reproduce this issue on our end. We will check it soon.

rgr:

Problem #2:

When we save to a workbook, no matter which version, the checkbox columns end up as 1's and 0's, which is ok, but, when we import the same worksheet into grid desktop, the checkboxes are removed and replaced with 1's and 0's. Is this by design, or are we doing something wrong?

Yes, this is by design that you will get "1" or "0" in the exported file and also when you will import that file to GridDesktop, these controls will be rendered and replaced by their Boolean values of the checkboxes.

rgr:

Problem #3:

How can we programmatically select a different worksheet in grid desktop?

You may use ActiveSheetIndex property of GridDesktop control for your needs, e.g:
this.gridDesktop1.ActiveSheetIndex = 1; //Activate your second sheet in the workbook.


Thank you.

Thank you for your quick response.

You may check the checkboxes and then click on button1 to run the code. Everything registers correctly on “Sheet 1”, but in Sheet 2 and Sheet 3, all of the checkboxes will register as True, whether they are checked or not.

Also, on Sheet 1, when you drag and drop from the combobox onto cell “A1”, nothing registers until another cell gets focus. You can drag and drop onto cell “A1”, then drag and drop into another cell then both cells will show their values. You can delete the value in cell “A1”, drag and drop again, and again, nothing will show.

Hi,


Thanks for the sample project.

I have run your project. I can find the issue as you mentioned regarding drap n drop items into Grid’s matrix as you pointed. It might be due to design. Anyways, I have logged a ticket with an id “CELLSNET-41287” for it and we will look into it soon.

For your first issue regarding “but in Sheet 2 and Sheet 3, all of the checkboxes will register as True, whether they are checked or not”, I could not find/evaluate your issue properly. Do you mean if we save to Excel file all the checkboxes in Sheet 2 and Sheet 3 are rendered as “1”? Please elaborate it a bit, so we could log it as well.

Thank you.

For example, on Sheet 2, if you check “D2” and “H1”, all of the checkboxes in Column D and Column H will evaluate to True. If you break the code and use intellisense, you can verify this.

We think that this is because when adding the checkbox like this:

GridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)

The checkboxes are all added as 1 instance. However, this does not explain why Sheet 1 behaves “normally” when Sheet 2 and Sheet3 do not behave “normally”.

When we try this:

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

The checkboxes are populated in Sheet 1, but they are not populated in Sheet2 and Sheet 3. The columns remain blank.

Also, in the same sample we uploaded, when we enter any value in “E1” then using the keyboard, (Enter, Arrow key, Tab, for example), we move to “G2” for example, we can not enter in a value unless we actually click on the cell.

Hi,

Thanks for your further details.

rgr:


When we try this:

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

The checkboxes are populated in Sheet 1, but they are not populated in Sheet2 and Sheet 3. The columns remain blank.

As I can see your code in Page_Load:
e.g
Dim sheet As Aspose.Cells.GridDesktop.Worksheet = GridDesktop1.GetActiveWorksheet()
..............

Well, I think this is due to the fact that by default your current active sheet is Sheet1 (active sheet index =0) (as per your code segment), so the above code will be processed for Sheet1 only and not for Sheet2 or Sheet3. You need to explicitly write/update your code for Sheet2 or Sheet3 accordingly to add checkboxes into those sheets as well.

rgr:

Also, in the same sample we uploaded, when we enter any value in "E1" then using the keyboard, (Enter, Arrow key, Tab, for example), we move to "G2" for example, we can not enter in a value unless we actually click on the cell.

Yes, you are right, we can see this behavior, I think this is again by design. We will look into it and check if we can enhance it for your needs.


rgr:
For example, on Sheet 2, if you check "D2" and "H1", all of the checkboxes in Column D and Column H will evaluate to True. If you break the code and use intellisense, you can verify this.

We think that this is because when adding the checkbox like this:

GridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)

The checkboxes are all added as 1 instance. However, this does not explain why Sheet 1 behaves "normally" when Sheet 2 and Sheet3 do not behave "normally".

This might be due to your active sheet which is Sheet1. We will look into it further too.

Thank you.

Thanks for your help in this regard. As you can see, we add 2 worksheets then add the formatting and checkboxes, and formulas. Each sheet has the formatting and formulas. Are we supposed to add the checkboxes in a different way for each new sheet?

When we do:

gridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False) for sheet 2 and sheet 3, yes, the intellisense shows the checkboxes to be from sheet1 on all 3 sheets.

When we do:

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

The checkboxes do not seem to get added to sheet 2 and sheet 3.

Hi


For:

"gridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)"

As I said earlier, by default the first worksheet i.e. Sheet1 would be active (Note: only one worksheet can be active at a time), so when the above line is processed, it would not add check boxes to other sheets except Sheet1. To add check boxes for D column in other sheets, e.g in Sheet2, you may add the line:
e.g
gridDesktop1.Worksheets(1).Columns(3).AddCheckBox(False)
or
gridDesktop1.Worksheets(“Sheet2”).Columns(3).AddCheckBox(False)

Similarly for:
"When we do:

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next"

It would only add check box controls for Sheet1 as “sheet” object is obtained based the active sheet (which is Sheet1 by default).

Thanks for your understanding!

Thank you for your suggestion. We are sure it will work. How about the drag/drop onto cell A1, and the keyboard navigation/entering data issues?

Hi,


1) For Drag n drop issue, we have already added a ticket with an id “CELLSNET-41287” for it.
2) For keyboard navigation/entering data issue, we have logged a separate ticket with an id “CELLSNET-41291” for it.

Once we figure any of the issues out or have any update on it, we will let you know here.

Thank you.
Hi,

1) We have further evaluated your issue, we think the issue only exists in the cell with position 0,0 (e.g A1), so you may try to use the below workaround to avoid this small issue at the moment if possible:
e.g
If cel.Row = 0 And cel.Column = 0 Then

sheet.SetFocusedCell(0, 1)
sheet.SetFocusedCell(0, 0)
End If

Hope, this helps

Thank you.

Hi,

Thanks for using Aspose.Cells for GridDesktop.

For your issue logged as CELLSNET-41291 (i.e using the keyboard navigate to any cell(Enter, Arrow key, Tab, etc),user can not enter any value until actually click on the cell.)

Please download and try this fix: Aspose.Cells for GridDesktop v2.7.14.2001 and let us know your feedback.

Hi,

For your issue logged as CELLSNET-41287.

We have workaround for this issue. As the issue occurs only at the cell at 0,0 position, you can add something like this:

VB.NET


If cel.Row = 0 And cel.Column = 0 Then

sheet.SetFocusedCell(0, 1)

sheet.SetFocusedCell(0, 0)

End If


Please see the complete code below for your reference. We have also attached the updated file for your help which can download and try at your end.

VB.NET
Imports Aspose.Cells.GridDesktop

Public Class Form1



Private suppressedevents As Boolean
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
suppressedevents = True
GridDesktop1.AllowDrop = True

GridDesktop1.ShowContextMenu = True
GridDesktop1.RowHeaderVisible = True

'GridDesktop1.Worksheets().Add("Sheet 2", 36, 12)

GridDesktop1.GetActiveWorksheet().Columns(0).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(1).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(2).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(3).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(4).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(5).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(6).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(7).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(7).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(8).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(9).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(10).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(11).Width = 50

Dim rngPlayer1 As CellRange = New CellRange(0, 0, 35, 0)
Dim rngSep As CellRange = New CellRange(0, 1, 35, 1)
Dim rngPlayer2 As CellRange = New CellRange(0, 2, 35, 2)
'Dim rngWL1 As CellRange = New CellRange(0, 3, 35, 3)
Dim rngScore1 As CellRange = New CellRange(0, 4, 35, 4)
Dim rngVS As CellRange = New CellRange(0, 5, 35, 5)
Dim rngScore2 As CellRange = New CellRange(0, 6, 35, 6)
'Dim rngWL2 As CellRange = New CellRange(0, 7, 35, 7)
Dim rngPlayer3 As CellRange = New CellRange(0, 8, 35, 8)
Dim rngSep2 As CellRange = New CellRange(0, 9, 35, 9)
Dim rngPlayer4 As CellRange = New CellRange(0, 10, 35, 10)
Dim rngTotal As CellRange = New CellRange(0, 11, 35, 11)

GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngVS)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer3)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer4)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngTotal)


GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 1, 35, 1), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 5, 35, 5), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 9, 35, 9), True)


Dim stylePlayer As Aspose.Cells.GridDesktop.Style = New Aspose.Cells.GridDesktop.Style(GridDesktop1)
stylePlayer.HAlignment = HorizontalAlignmentType.Centred
stylePlayer.VAlignment = VerticalAlignmentType.Centred
stylePlayer.Color = Color.White
stylePlayer.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Bottom, BorderLineType.Thin)
stylePlayer.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Left, BorderLineType.Thin)
stylePlayer.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Top, BorderLineType.Thin)
stylePlayer.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Right, BorderLineType.Thin)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer1, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer2, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer3, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer4, stylePlayer)

Dim styleSep As Aspose.Cells.GridDesktop.Style = New Aspose.Cells.GridDesktop.Style(GridDesktop1)
styleSep.HAlignment = HorizontalAlignmentType.Centred
styleSep.VAlignment = VerticalAlignmentType.Centred
styleSep.Color = Color.OliveDrab
styleSep.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Bottom, BorderLineType.Thin)
styleSep.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Left, BorderLineType.Thin)
styleSep.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Top, BorderLineType.Thin)
styleSep.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Right, BorderLineType.Thin)
GridDesktop1.GetActiveWorksheet().SetStyle(rngSep, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngSep2, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngVS, styleSep)

Dim sheet As Aspose.Cells.GridDesktop.Worksheet = GridDesktop1.GetActiveWorksheet()

Dim c As Integer
For c = 0 To 35
sheet.Controls.AddCheckBox(c, 3, False)
sheet.Controls.AddCheckBox(c, 7, False)
Next

Dim cel As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim i As Integer
For i = 0 To rngSep.EndRow - 1
cel(i, 1).SetCellValue("Z")
Next
Dim cel2 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim ii As Integer
For ii = 0 To rngSep2.EndRow - 1
cel2(ii, 5).SetCellValue("Z")
Next
Dim cel3 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim iii As Integer
For iii = 0 To rngVS.EndRow - 1
cel3(iii, 9).SetCellValue("Z")
Next

Dim cel4 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim f As Integer
For f = 0 To rngTotal.EndRow
cel4(f, 11).SetCellValue("= ABS(E" & f + 1 & "-" & "G" & f + 1 & ")")
Next

GridDesktop1.GetActiveWorksheet().Cells("L37").SetCellValue("=SMALL('Round 1'!L1:L36,COUNTIF($L$1:$L$36,0)+1)")
GridDesktop1.GetActiveWorksheet().Cells("C37").SetCellValue("=MOD(COUNTA(C1:C36),2)")


Dim styleWL As Aspose.Cells.GridDesktop.Style = New Aspose.Cells.GridDesktop.Style(GridDesktop1)

'styleWL.HAlignment = HorizontalAlignmentType.Centred
'styleWL.VAlignment = VerticalAlignmentType.Centred
'styleWL.Color = Color.Wheat
'styleWL.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Bottom, BorderLineType.Thin)
'styleWL.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Left, BorderLineType.Thin)
'styleWL.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Top, BorderLineType.Thin)
'styleWL.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Right, BorderLineType.Thin)
'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL1, styleWL)
'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL2, styleWL)

Dim styleScore As Aspose.Cells.GridDesktop.Style = New Aspose.Cells.GridDesktop.Style(GridDesktop1)
styleScore.HAlignment = HorizontalAlignmentType.Centred
styleScore.VAlignment = VerticalAlignmentType.Centred
styleScore.Color = Color.Tan
styleScore.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Bottom, BorderLineType.Thin)
styleScore.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Left, BorderLineType.Thin)
styleScore.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Top, BorderLineType.Thin)
styleScore.SetBorderLine(Aspose.Cells.GridDesktop.BorderType.Right, BorderLineType.Thin)
GridDesktop1.GetActiveWorksheet().SetStyle(rngScore1, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngScore2, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngTotal, styleScore)
GridDesktop1.GetActiveWorksheet().SetFocusedCell(0, 0)

GridDesktop1.Worksheets().Add("Sheet 2", 36, 12)


GridDesktop1.GetActiveWorksheet().Columns(0).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(1).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(2).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(3).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(4).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(5).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(6).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(7).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(7).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(8).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(9).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(10).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(11).Width = 50


GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngVS)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer3)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer4)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngTotal)

GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 1, 35, 1), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 5, 35, 5), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 9, 35, 9), True)

GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer1, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer2, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer3, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer4, stylePlayer)

GridDesktop1.GetActiveWorksheet().SetStyle(rngSep, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngSep2, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngVS, styleSep)

Dim cels2 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim is2 As Integer
For is2 = 0 To rngSep.EndRow
cels2(is2, 1).SetCellValue("Z")
Next
Dim cel2s2 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim iis2 As Integer
For iis2 = 0 To rngSep2.EndRow
cel2s2(iis2, 5).SetCellValue("Z")
Next
Dim cel3s2 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim iiis2 As Integer
For iiis2 = 0 To rngVS.EndRow
cel3s2(iiis2, 9).SetCellValue("Z")
Next

Dim cel4s2 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim fs2 As Integer
For fs2 = 0 To rngTotal.EndRow
cel4s2(fs2, 11).SetCellValue("= ABS(E" & fs2 + 1 & "-" & "G" & fs2 + 1 & ")")
Next

GridDesktop1.GetActiveWorksheet().Cells("L37").SetCellValue("=SMALL('Round 2'!L1:L36,COUNTIF($L$1:$L$36,0)+1)")
GridDesktop1.GetActiveWorksheet().Cells("C37").SetCellValue("=MOD(COUNTA(C1:C36),2)")

'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL1, styleWL)
'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL2, styleWL)

GridDesktop1.GetActiveWorksheet().SetStyle(rngScore1, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngScore2, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngTotal, styleScore)
GridDesktop1.GetActiveWorksheet().SetFocusedCell(0, 0)

GridDesktop1.Worksheets().Add("Sheet 3", 36, 12)

GridDesktop1.GetActiveWorksheet().Columns(0).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(1).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(2).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(3).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(3).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(4).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(5).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(6).Width = 50
GridDesktop1.GetActiveWorksheet().Columns(7).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(7).AddCheckBox(False)
GridDesktop1.GetActiveWorksheet().Columns(8).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(9).Width = 20
GridDesktop1.GetActiveWorksheet().Columns(10).Width = 100
GridDesktop1.GetActiveWorksheet().Columns(11).Width = 50


GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore1)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngVS)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngScore2)
'gridDesktop1.GetActiveWorksheet().AddSelectedRange(rngWL2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer3)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngSep2)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngPlayer4)
GridDesktop1.GetActiveWorksheet().AddSelectedRange(rngTotal)

GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 1, 35, 1), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 5, 35, 5), True)
GridDesktop1.GetActiveWorksheet.SetProtected(New CellRange(0, 9, 35, 9), True)

GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer1, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer2, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer3, stylePlayer)
GridDesktop1.GetActiveWorksheet().SetStyle(rngPlayer4, stylePlayer)

GridDesktop1.GetActiveWorksheet().SetStyle(rngSep, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngSep2, styleSep)
GridDesktop1.GetActiveWorksheet().SetStyle(rngVS, styleSep)

Dim cels3 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim is3 As Integer
For is3 = 0 To rngSep.EndRow
cels3(is3, 1).SetCellValue("Z")
Next
Dim cel2s3 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim iis3 As Integer
For iis3 = 0 To rngSep2.EndRow
cel2s3(iis3, 5).SetCellValue("Z")
Next
Dim cel3s3 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim iiis3 As Integer
For iiis3 = 0 To rngVS.EndRow
cel3s3(iiis3, 9).SetCellValue("Z")
Next
Dim cel4s3 As Aspose.Cells.GridDesktop.CellCollection = GridDesktop1.GetActiveWorksheet().Cells()
Dim fs3 As Integer
For fs3 = 0 To rngTotal.EndRow
cel4s3(fs3, 11).SetCellValue("= ABS(E" & fs3 + 1 & "-" & "G" & fs3 + 1 & ")")
Next

GridDesktop1.GetActiveWorksheet().Cells("L37").SetCellValue("=SMALL('Round 3'!L1:L36,COUNTIF($L$1:$L$36,0)+1)")
GridDesktop1.GetActiveWorksheet().Cells("C37").SetCellValue("=MOD(COUNTA(C1:C36),2)")

'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL1, styleWL)
'gridDesktop1.GetActiveWorksheet().SetStyle(rngWL2, styleWL)

GridDesktop1.GetActiveWorksheet().SetStyle(rngScore1, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngScore2, styleScore)
GridDesktop1.GetActiveWorksheet().SetStyle(rngTotal, styleScore)
' GridDesktop1.ActiveSheetIndex = 0
' GridDesktop1.GetActiveWorksheet().Cells("A1").SetCellValue("test1")


Me.GridDesktop1.ActiveSheetIndex = 0
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim CheckBoxArray As New ArrayList
Dim thisRound As Aspose.Cells.GridDesktop.Worksheet = GridDesktop1.GetActiveWorksheet()
Dim thisSheetIndex As Integer = GridDesktop1.ActiveSheetIndex
Dim nextSheetIndex As Integer = GridDesktop1.ActiveSheetIndex + 1
Dim nextRound As Aspose.Cells.GridDesktop.Worksheet = GridDesktop1.Worksheets(nextSheetIndex)
Dim i As Integer
Dim ii, iii As Integer
Dim r As Integer
Dim myResult As Integer

'Try
If IsNumeric(thisRound.Cells(0, 4).Value) Then
For r = 0 To 35

If IsNothing(thisRound.Cells(r, 4).Value) Then

Dim LL As Integer
For LL = 0 To r - 1
If thisRound.Cells(LL, 4).Value > thisRound.Cells(LL, 6).Value And thisRound.Cells(LL, 11).Value = thisRound.Cells(36, 11).Value Then
nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(LL, 8).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(LL, 10).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Magenta)
nextRound.Cells(ii, 10).SetFontColor(Color.Magenta)
ElseIf thisRound.Cells(LL, 6).Value > thisRound.Cells(LL, 4).Value And thisRound.Cells(LL, 11).Value = thisRound.Cells(36, 11).Value Then
nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(LL, 0).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(LL, 2).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Magenta)
nextRound.Cells(ii, 10).SetFontColor(Color.Magenta)
End If
Next

Exit Sub
Else
myResult = iii Mod 2
If myResult = 0 Then
If thisRound.Cells(r, 4).Value > thisRound.Cells(r, 6).Value Then

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Red)
nextRound.Cells(i, 2).SetFontColor(Color.Red)
Else

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Black)
nextRound.Cells(i, 2).SetFontColor(Color.Black)


End If
i = i + 1
Else
If thisRound.Cells(r, 4).Value > thisRound.Cells(r, 6).Value Then

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Red)
nextRound.Cells(ii, 10).SetFontColor(Color.Red)

Else

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Black)
nextRound.Cells(ii, 10).SetFontColor(Color.Black)


End If
ii = ii + 1
End If
iii = iii + 1


End If

Next

Else

For r = 0 To 35

Dim chk1 As Aspose.Cells.GridDesktop.CheckBox = CType(GridDesktop1.GetActiveWorksheet().Controls(r, 3), Aspose.Cells.GridDesktop.CheckBox)
Dim chk2 As Aspose.Cells.GridDesktop.CheckBox = CType(GridDesktop1.GetActiveWorksheet().Controls(r, 7), Aspose.Cells.GridDesktop.CheckBox)

If chk1.Checked = False And chk2.Checked = False Then
If CheckBoxArray.Count > 0 Then
Dim part As String
Dim Np As Integer
For Np = 0 To CheckBoxArray.Count - 1
part &= CheckBoxArray(Np).ToString & ControlChars.Tab
part &= Environment.NewLine
Next
MsgBox("You have " & Np & " Checkboxes: " & vbCrLf & vbCrLf & part, , "CheckBoxes")
End If

Exit Sub
End If

myResult = iii Mod 2

If myResult = 0 Then

If chk1.Checked Then

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Red)
nextRound.Cells(i, 2).SetFontColor(Color.Red)

Dim message As String
If chk1.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 3 " + message)

If chk2.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 7 " + message)


Else

nextRound.Cells(i, 0).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(i, 2).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(i, 0).SetFontColor(Color.Black)
nextRound.Cells(i, 2).SetFontColor(Color.Black)

Dim message As String
If chk1.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 3 " + message)

If chk2.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 7 " + message)

End If
i = i + 1
Else
If chk1.Checked Then

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 0).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 2).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Red)
nextRound.Cells(ii, 10).SetFontColor(Color.Red)

Dim message As String
If chk1.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 3 " + message)

If chk2.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 7 " + message)

Else

nextRound.Cells(ii, 8).SetCellValue(thisRound.Cells(r, 8).Value)
nextRound.Cells(ii, 10).SetCellValue(thisRound.Cells(r, 10).Value)
nextRound.Cells(ii, 8).SetFontColor(Color.Black)
nextRound.Cells(ii, 10).SetFontColor(Color.Black)

Dim message As String
If chk1.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 3 " + message)

If chk2.Checked Then
message = "Checked!"
Else
message = "Unchecked!"
End If
CheckBoxArray.Add("CellChecked. " + "Row:" + r.ToString() + ", Column: 7 " + message)

End If
ii = ii + 1
End If
iii = iii + 1
Next
End If
'Catch ex As Exception
' MsgBox(ex.Message)
'End Try
'Me.gridDesktop1.ActiveSheetIndex = nextSheetIndex
End Sub

Private Sub GridDesktop1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles GridDesktop1.DragDrop
Dim grid As GridDesktop
grid = CType(sender, GridDesktop)
Dim sheet As Aspose.Cells.GridDesktop.Worksheet = grid.GetActiveWorksheet()
Dim clientPoint As Point = grid.PointToClient(New Point(e.X, e.Y))
Dim cel As CellLocation = grid.GetActiveWorksheet().GetCellLocationByClientPoint(clientPoint)
If cel.Column = -1 Then
Exit Sub
End If

Try
If e.Data.GetDataPresent(DataFormats.Text) Then
Dim pasteCell As String
pasteCell = e.Data.GetData(DataFormats.Text)
sheet.SetFocusedCell(cel.Row, cel.Column)
sheet.Cells(cel.Row, cel.Column).Value = pasteCell
'small workaround for CELLSNET-41287
If cel.Row = 0 And cel.Column = 0 Then

sheet.SetFocusedCell(0, 1)
sheet.SetFocusedCell(0, 0)
End If


e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None

End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

e.Effect = DragDropEffects.None
End Sub

Private Sub ComboBox1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ComboBox1.MouseDown
If ComboBox1.DroppedDown = True Then
Exit Sub
End If

Dim cbo As System.Windows.Forms.ComboBox = Me.ComboBox1
cbo = CType(sender, System.Windows.Forms.ComboBox)
Dim cboText As String


If cbo.SelectedIndex > -1 AndAlso cbo.DroppedDown = False Then
cboText = cbo.Text
cbo.DoDragDrop(TryCast(cboText, String), DragDropEffects.Copy)
Else
cbo.DroppedDown = True
End If
End Sub

Private Sub GridDesktop1_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles GridDesktop1.DragEnter
Dim grid As GridDesktop
grid = CType(sender, GridDesktop)

If e.Data.GetDataPresent(DataFormats.Text) Then

e.Effect = DragDropEffects.Copy
'Else
' e.Effect = DragDropEffects.None
End If

End Sub
End Class

Thank you for helping us in these matters.

1) For the checkboxes on different sheets, explicitly stating the worksheet index while iterating through the rows, adding checkboxes works.

2) The work around for the drag/drop into cell (0,0) works.

3) The download you provided us does not work. Although the download is titled “<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>ZH-CN</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val=”–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”>Aspose.Cells
for GridDesktop v2.7.14.2001", the contents are actually for the “GridWeb” control.
<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:PMingLiU; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi,

Thanks for sharing your feedback and using Aspose.

Please download latest Aspose.Cells for GridDesktop from the following link.

Attachment: Aspose.Cells.GrideDesktop v2.7.14.2001.zip


If you face any other issue, please feel free to post. We will be glad to help you asap.

Have a good day and happy new year to you. :slight_smile:

Thank you for the last download. All the issues seem to be resolved. Happy Holidays.

Hi,


Good to know that your issues are sorted out now.

Feel free to contact us any time, if you need further help or have any issue, we will be happy to assist you further.

We also wish you happy holidays from our side.

Thanks,

The issues you have found earlier (filed as CELLSNET-41291) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.