{
gcMultiRow1.SetValue(0, “textBoxCell4”, “改修工事”); //改修工事
}
MultiRow for Windows Forms 6.0Jで、コンボボックスに動的にデータセット
MultiRow for Windows Forms 6.0Jで、コンボボックスに動的にデータセット
既存のテンプレートのコンボボックス型セルに対して、リストを設定
するには下記のサンプルコードのようにします。
この例では、Template1がデザイナで作成したテンプレートになります。
【サンプルコード】
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GrapeCity.Win.MultiRow;
namespace M100902020
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeMultiRow();
}
private void InitializeMultiRow()
{
// 既存のテンプレートの変更
Template test = new Template1();
ComboBoxCell comboCell = test.Row.Cells[“comboBoxCell1”] as ComboBoxCell;
comboCell.Items.Add(“ガーナ”);
comboCell.Items.Add(“バングラデッシュ”);
comboCell.Items.Add(“ネパール”);
// MultiRowの設定
gcMultiRow1.Template = test;
gcMultiRow1.SetValue(0, “comboBoxCell1”, “ネパール”);
}
}
}
TableAdapterに ‘Update’ の定義が含まれておらず

【エラー1】
・・・TableAdapters.TableAdapter’ に ‘Update’ の定義が含まれておらず、型 ‘・・・TableAdapter’ の最初の引数を受け付ける拡張メソッドが見つかりませんでした。
using ディレクティブまたはアセンブリ参照が不足しています。
【対処】


C# 文字列を数値変換
//文字列をint型に変換
int i = int.Parse(“100”);
//文字列をlong型に変換
long l = long.Parse(“100”);
//文字列をfloat型に変換
float f = float.Parse(“100.1”);
//文字列をdouble型に変換
double d = double.Parse(“100.1”);
//文字列をbool型に変換
bool b = bool.Parse(“True”);
ClickOnceが持つセキュリティ
[エラーメッセージ]
警告 1 Importing key file “□□□_TemporaryKey.pfx” was canceled.
[解決策]
「コードサイニング証明書(Authenticode対応Digital ID)」が必要となる。
ClickOnceの証明書を作成する
VS2008にて、ソリューションエクスプローラ
「Properties」 → 「署名」 → 「ファイルから選択」 or 「テスト署名作成」
証明書(C)に、発行先/発行元/使用目的/有効期限が表示されます。
→ ビルド
TableAdapterにLIKE条件の設定(C#2.0)

[JoyDS1.xsd]
tb_keiyakuTableAdapter
EiChiki(PARAM1, PARAM2, PARAM3)の中身
SELECT * FROM tb_keiyaku WHERE (xx LIKE :PARAM3);
// ===================================
// TableAdapterの設定
// フィルタを設定(2010.5.24)
// ===================================
private void TableSET()
{
this.TableAdapter.EiChiki(DS, TP2.Value, TP1.Value, “%” + tBoxAdd.Text + “%”);
}
C# 日付け変換可能かチェックする
string str = “2009/10/8”;
DateTime dt;
//DateTimeに変換できるかチェックする
if (DateTime.TryParse(str, out dt))
{ //日付け変換可能の場合の処理
Console.WriteLine(“{0}はDateTimeに変換できます。”, str);
}
else
{ //日付け変換できない場合の処理
Console.WriteLine(“{0}はDateTimeに変換できません。”, str);
}
文字列を数値に変換するか検証
string s = "123";
int num;
if (int.TryParse(s, out num))
{
Console.WriteLine("{0} は、数字です。", s);
}
else
{
Console.WriteLine("{0} は、数字ではありません。", s);
}
s = "abc";
if (int.TryParse(s, out num))
{
Console.WriteLine("{0} は、数字です。", s);
}
else
{
Console.WriteLine("{0} は、数字ではありません。", s);
}
標準数値書式指定文字列
通貨記号や小数桁等が挿入される
[例]
int i = 12345;
CultureInfo jp = new CultureInfo( "ja-JP" );
Console.WriteLine( i.ToString("C2",jp) ); // 12,345.00
整数部に 3 桁ごとの区切りを入れる
[例]
int i = 12345;
Console.WriteLine( i.ToString("N") ); // 12,345.00
Console.WriteLine( i.ToString("N0") ); // 12,345
C#からMySQLのUPDATE時エラー
C#
MySQL 5.0x
Tableの項目名に日本語を使用するとUPDATEができない。
半角英数字に項目名を変更すれば、問題ありません。