私は2列のDataGridView
ていますDataGridViewでComboBox列を作成する方法は?
Fname | Age
私は(私は100に1間の年齢を選択できること)ComboBox
でAge
を表示する必要があります。
ボタンを押すと(例:保存ボタン)、Ageの値がデータベースに保存されます。 (私はアクセスして作業します)
これのためにC#でサンプルを取得できますか?
私は2列のDataGridView
ていますDataGridViewでComboBox列を作成する方法は?
Fname | Age
私は(私は100に1間の年齢を選択できること)ComboBox
でAge
を表示する必要があります。
ボタンを押すと(例:保存ボタン)、Ageの値がデータベースに保存されます。 (私はアクセスして作業します)
これのためにC#でサンプルを取得できますか?
MSDNを確認しましたか? DataGridViewComboBoxColumn Classに良い例があります。
DataGridViewComboBoxColumn
を試しましたか?
これは、 "DataGridViewComboBoxCell
オブジェクトの列"を表し、それぞれがDataGridViewにComboBoxコントロールを表示します。
上記のリンクされたMSDNドキュメントには、これを実装する方法の例もあります。しかし、Visual Studioデザイナーから行う方が簡単です。 1行のコードを書く必要はありません。
string value = combodisease.SelectedItem.ToString();
string str = "select test, normal, high, cost from testname join testcost on testcost.testid=testname.testid where test='"+value+"'";
SqlDataAdapter da = new SqlDataAdapter(str, cn);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
あなたは私が設計して、データブロックビュー(winforms)の列(インデックス1)をコンボボックスカラムに入れるのを手伝ってもらえますか? – Sukanya