PowerTools CalendarGrid for Windows Forms 1.0J
SetValue(DateTime,String,Object) メソッド
使用例 

セルが属する CalendarTable の日付。
セルの名前。
設定する値。
指定したセルに値を設定します。多数のセルの値を設定するときは、このメソッドを使用する方が Value プロパティを使用するよりもパフォーマンスが向上します。
構文
Public Overloads Sub SetValue( _
   ByVal date As Date, _
   ByVal cellName As String, _
   ByVal value As Object _
) 
public void SetValue( 
   DateTime date,
   string cellName,
   object value
)

パラメータ

date
セルが属する CalendarTable の日付。
cellName
セルの名前。
value
設定する値。
使用例
次のサンプルコードは、値を設定する方法を示します。
private void SetValue()
{
    // Use name to access the cell.
    this.gcCalendarGrid1.Template.Content[2, 0].Name = "cell1";

    // Set value to a cell in today.
    this.gcCalendarGrid1[DateTime.Today][1, 0].Value = "abc";
    this.gcCalendarGrid1[DateTime.Today]["cell1"].Value = "abc";

    // Set value to the cells in a date range.
    IEnumerable<DateTime> dateRange = DateRange.CreateDateRange(new DateTime(2014, 2, 1), new DateTime(2014, 2, 20));
    this.gcCalendarGrid1[dateRange][1, 0].Value = "abc";
    this.gcCalendarGrid1[dateRange]["cell1"].Value = "abc";

    // Set value to the cells in a yearly recurrence.
    IEnumerable<DateTime> yearlyDate = DateRange.CreateYearlyDayRecurrence(new DateTime(2000, 2, 1), 1, 100);
    this.gcCalendarGrid1[yearlyDate][1, 0].Value = "abc";
    this.gcCalendarGrid1[yearlyDate]["cell1"].Value = "abc";

    // Set value to the cells in a monthly weekday recurrence.
    IEnumerable<DateTime> monthlyWeekday = DateRange.CreateMonthlyWeekDayRecurrence(new DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, new DateTime(2014, 12, 31));
    this.gcCalendarGrid1[monthlyWeekday][1, 0].Value = "abc";
    this.gcCalendarGrid1[monthlyWeekday]["cell1"].Value = "abc";

    // Set value to many cells. By the SetValue method, we can get better performance.
    for (int row = 0; row < this.gcCalendarGrid1.Template.RowCount; row++)
    {
        for (int column = 0; column < this.gcCalendarGrid1.Template.ColumnCount; column++)
        {
            this.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc");
        }
    }

    // Clear the values and formats set to a date, to release the memory.
    this.gcCalendarGrid1.Clear(DateTime.Today);

    // Clear all the values and formats, to release the memory.
    this.gcCalendarGrid1.ClearAll();
}
Private Sub SetValue()
    ' Use name to access the cell.
    Me.gcCalendarGrid1.Template.Content(2, 0).Name = "cell1"

    ' Set value to a cell in today.
    Me.gcCalendarGrid1(DateTime.Today)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(DateTime.Today)("cell1").Value = "abc"

    ' Set value to the cells in a date range.
    Dim dateRange__1 As IEnumerable(Of DateTime) = DateRange.CreateDateRange(New DateTime(2014, 2, 1), New DateTime(2014, 2, 20))
    Me.gcCalendarGrid1(dateRange__1)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(dateRange__1)("cell1").Value = "abc"

    ' Set value to the cells in a yearly recurrence.
    Dim yearlyDate As IEnumerable(Of DateTime) = DateRange.CreateYearlyDayRecurrence(New DateTime(2000, 2, 1), 1, 100)
    Me.gcCalendarGrid1(yearlyDate)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(yearlyDate)("cell1").Value = "abc"

    ' Set value to the cells in a monthly weekday recurrence.
    Dim monthlyWeekday As IEnumerable(Of DateTime) = DateRange.CreateMonthlyWeekDayRecurrence(New DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, New DateTime(2014, 12, 31))
    Me.gcCalendarGrid1(monthlyWeekday)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(monthlyWeekday)("cell1").Value = "abc"

    ' Set value to many cells. By the SetValue method, we can get better performance.
    For row As Integer = 0 To Me.gcCalendarGrid1.Template.RowCount - 1
        For column As Integer = 0 To Me.gcCalendarGrid1.Template.ColumnCount - 1
            Me.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc")
        Next
    Next

    ' Clear the values and formats set to a date, to release the memory.
    Me.gcCalendarGrid1.Clear(DateTime.Today)

    ' Clear all the values and formats, to release the memory.
    Me.gcCalendarGrid1.ClearAll()
End Sub
参照

GcCalendarGrid クラス
GcCalendarGrid メンバ
オーバーロード一覧

 

 


© 2014 GrapeCity inc. All rights reserved.