[サンプルコード]
Form Form1 {
X = 0;
Y = 0;
Width = 240;
Height = 300;
CSVDocument csvobj1;
CSVDocument csvobj2;
TextBox TextBox1 {
X = 10;
Y = 80;
Width = 100;
Height = 20;
}
Button Button1 {
X = 10;
Y = 10;
Width = 125;
Height = 20;
Title = "getSellByName実行";
Function OnTouch( e ) {
/* 0行目の各列を列名を指定して取得 */
^.Label1[0] = ^.csvobj1.getCellByName( 0, "id" );
^.Label1[1] = ^.csvobj1.getCellByName( 0, "name" );
^.Label1[2] = ^.csvobj1.getCellByName( 0, "furi" );
}
}
Label Label1[3] {
X = 140;
Y = 10;
Width = 90;
Height = 20;
}
Button Button2 {
X = 115;
Y = 80;
Width = 115;
Height = 20;
Title = "setSellByName実行";
Function OnTouch( e ) {
/* 0行目の name 列をテキストボックスの値に変更 */
^.csvobj1.setCellByName( 0, "name", ^.TextBox1.Value );
}
}
Button Button3 {
X = 10;
Y = 140;
Width = 125;
Height = 20;
Title = "getSellByName実行";
Function OnTouch( e ) {
/* 0行目の各列を列名を指定して取得 */
^.Label2[0] = ^.csvobj2.getCellByName( 0, "id" );
^.Label2[1] = ^.csvobj2.getCellByName( 0, "name" );
^.Label2[2] = ^.csvobj2.getCellByName( 0, "furi" );
}
}
Label Label2[3] {
X = 140;
Y = 140;
Width = 90;
Height = 20;
}
if ( !$DESIGNTIME ) {
csvobj1 << CSV{
1,鈴木,すずき
2,林,はやし
3,田中,たなか
};
/* 列名を設定する */
csvobj1.setColumnName( 0, "id" );
csvobj1.setColumnName( 1, "name" );
csvobj1.setColumnName( 2, "furi" );
/* 列名を設定する */
csvobj2 << CSV( id, name, furi ){
1,山田,やまだ
2,青山,あおやま
3,吉本,よしもと
};
}
}
|