私はというクラスを持っていますrateTime
class rateTime
{
private List<string> t = new List<string>();
private List<string> s = new List<string>();
public rateTime(string[] time, string[] sender)
{
for (int i = 0; i < time.Length; i++)
{
t.Add(time[i]);
s.Add(sender[i]);
}
}
~rateTime() { }
public List<string> Time
{
get { return t;}
set { t = value; }
}
public List<string> Sender
{
get { return s; }
set { s = value; }
}
}
コンボボックスのデータソースは次のように設定されています。
rateTime rt = new rateTime(time, rateSender);
cb_rateTime.DataSource = rt.Time;
cb_rateTime.DisplayMember = "time";
両方のリストに28個の文字列があります。リストtのアイテムをコンボボックスアイテムとして設定しました。また、たとえば10のように、インデックス付きのコンボボックスからアイテムを選択した場合、インデックス10のリストから文字列を取得する方法を知りたいです。