【发布时间】:2012-05-23 06:32:28
【问题描述】:
我有一个班级叫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; }
}
}
我的组合框的DataSource设置如下:
rateTime rt = new rateTime(time, rateSender);
cb_rateTime.DataSource = rt.Time;
cb_rateTime.DisplayMember = "time";
在这两个列表中,我都有 28 个字符串。我将 List t 中的项目设置为组合框项目。如果我从索引为 10 的组合框中选择了一个项目,我想知道如何从索引为 10 的列表中获取字符串。
【问题讨论】:
-
这是一个可怕的问题。在发布一堆只说“我有上课时间”的代码之前,您需要讨论一下您正在做什么以及您想要实现的目标。
-
一个名为“YourMother”的用户的适当的、谴责的回应;)
-
哇,自从我使用 c++ 以来,我还没有看到使用过析构函数 ~...()