//費目コンボボックスの表示・・・・・・・・・・・
using (var con = new FbConnection(gro.conString))
using (var cmd = con.CreateCommand())
{
try
{
con.Open();
cmd.CommandText = @"select * from ItemsTable ";
var dt = new DataTable();
dt.Load(cmd.ExecuteReader());
comboHimoku.DataSource = dt;
}
finally
{
con.Close();
}
}
comboHimoku.DisplayMember = "himoku";
comboHimoku.ValueMember = "id";
//・・・・・・・・・・・・・・・・・・・・・
ValueMember を参照するには以下のとおり comboHimoku.SelectedValueを使う。
DataRow workRow = gro.mainDataTable.NewRow();
workRow["id"] = gro.mainDataTable.Rows.Count + 1;
workRow["inpData"] = d;
workRow["tekiyou"] = comboHimoku.SelectedValue.ToString();
workRow["inCome"] = numericUpDown.Text;
workRow["expend"] = numericUpDown.Text;
gro.mainDataTable.Rows.Add(workRow);