作成日: 2019/03/29 最終更新日: 2019/03/29
文書種別
使用方法
詳細
MultiRowには特定の名前のセルが存在するかどうかを調べるための専用の機能は備えられておりません。
特定のセル名が存在するかどうかは、以下のサンプルのように要素をすべて調べる必要があります。
[Visual Basic]
[C#]
特定のセル名が存在するかどうかは、以下のサンプルのように要素をすべて調べる必要があります。
[Visual Basic]
Imports GrapeCity.Win.MultiRow
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' テンプレートの作成
Dim template1 As Template = Template.CreateGridTemplate(2)
' MultiRowの設定
GcMultiRow1.Template = template1
GcMultiRow1.RowCount = 5
' セルの存在確認
Dim target As String = "textBoxCell1" ' 存在するセル名
'Dim target As String = "textBoxCell3" ' 存在しないセル名
Dim ret As Boolean = False
For Each c As Cell In GcMultiRow1.Template.Row.Cells
If c.Name = target Then
ret = True
Exit For
End If
Next
Console.WriteLine("{0}", ret)
End Sub
End Class
[C#]
using GrapeCity.Win.MultiRow;
using System;
using System.Windows.Forms;
namespace sample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// テンプレートの作成
Template template1 = Template.CreateGridTemplate(2);
// MultiRowの設定
gcMultiRow1.Template = template1;
gcMultiRow1.RowCount = 5;
// セルの存在確認
string target = "textBoxCell1"; // 存在するセル名
//string target = "textBoxCell3"; // 存在しないセル名
bool ret = false;
foreach(var c in gcMultiRow1.Template.Row.Cells)
{
if (c.Name == target)
{
ret = true;
break;
}
}
Console.WriteLine("{0}", ret);
}
}
}
旧文書番号
83792