日期:2014-05-18 浏览次数:20796 次
string s ="23,56,11,76"; string[] id=ids.Split(new char[',']);
string s ="23,56,11,76"; string[] id=ids.Split(new char[',']); int index = 0; 控制index就可以取id[index]的值了啊
------解决方案--------------------
private void btnFirst_Click(object sender, EventArgs e)
{
ShowStr("first");
}
private void btnPre_Click(object sender, EventArgs e)
{
ShowStr("pre");
}
private void btnNext_Click(object sender, EventArgs e)
{
ShowStr("next");
}
private void btnLast_Click(object sender, EventArgs e)
{
ShowStr("last");
}
private int pos = 0;
private void ShowStr(string flag)
{
string s = "23,56,11,76";
string[] id = s.Split(',');
if (id.Count() > 0)
{
switch (flag)
{
case "first":
pos = 0;
break;
case "pre":
if (pos == 0)
pos = id.Length - 1;
else
pos--;
break;
case "next":
if (pos == id.Length - 1)
pos = 0;
else
pos++;
break;
case "last":
pos = id.Length - 1;
break;
}
label1.Text = id[pos];
}
}