Posted By

sekihin on 03/10/15


Tagged

Winform spreadsheet


Versions (?)

コードで任意のセル範囲や行、列を選択状態にしたい


 / Published in: VB.NET
 

URL: http://www.grapecity.com/tools/support/technical/knowledge_detail.asp?id=33564

SelectionModelクラスのSetSelection メソッドにて選択範囲を設定することができます。

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.   ' アクティブセルの設定
  3.   FpSpread1.ActiveSheet.SetActiveCell(1, 0)
  4.   ' 2行目を選択
  5.   FpSpread1.ActiveSheet.Models.Selection.SetSelection(1, -1, 1, -1)
  6. End Sub
  7.  
  8. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  9.   ' アクティブセルの設定
  10.   FpSpread1.ActiveSheet.SetActiveCell(0, 1)
  11.   ' 2列目を選択
  12.   FpSpread1.ActiveSheet.Models.Selection.SetSelection(-1, 1, -1, 1)
  13. End Sub
  14.  
  15. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  16.   ' アクティブセルの設定
  17.   FpSpread1.ActiveSheet.SetActiveCell(1, 1)
  18.   ' B2セル~C3セルを選択
  19.   FpSpread1.ActiveSheet.Models.Selection.SetSelection(1, 1, 2, 2)
  20. End Sub

Report this snippet  

You need to login to post a comment.