如果我从其他地方传一组数组过来,要用表格显示要怎么写呀?是用C#写的

ASP_sem 2007-12-10 09:38:38

如果我从其他地方传一组数组过来,要用表格显示要怎么写呀?
比如,我传来的值是kk,qq;11,22;
以分号区分一个数组,kk,qq就是一个数组
那我要用表格显示为
区号 地区
kk qq
11 22
这个要咋写哦?就是传几组数据显示几组哦~~~~拜托大家教教我
...全文
78 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ASP_sem 2007-12-11
  • 打赏
  • 举报
回复
我传递过来的字符串是
1,101,CW728957...C0, 1.00;1,171,CW728957...ss, 77.00;

string [] infoarray=chkchild.Split(new char[] { ';' });
//先分割成 1,101,CW728957...C0, 1.00
// 1,171,CW728957...ss, 77.00

if (infoarray[0] =="1")
for (int i=0;i< infoarray.Length; i++);
{
string [] infoarray2=infoarray[i].Split(new char[] { ',' });
Response.Write(infoarray2[0]);
Response.Write(infoarray2[1]);
Response.Write(infoarray2[2]);
Response.Write(infoarray2[3]);

}
当我写上后面1-3是就报错,说索引超出数组范围哦???教教我
ASP_sem 2007-12-10
  • 打赏
  • 举报
回复
能不能详细点啊,这么将我不懂呀,不好意思哦~
ForTheLife 2007-12-10
  • 打赏
  • 举报
回复
自己创建table
lovesupper2008 2007-12-10
  • 打赏
  • 举报
回复
可以用ArrayList把!
ASP_sem 2007-12-10
  • 打赏
  • 举报
回复
web还是windows

都不会写,晕了,刚开始学的小鸟
ASP_sem 2007-12-10
  • 打赏
  • 举报
回复
private void PURMF_DPNO_TextChanged(object sender, System.EventArgs e)
// {
// string purmfdpno="";
// purmfdpno=this.PURMF_DPNO.Text.ToString().Trim().Trim();
// if (purmfdpno!="")
// {
// string getinfo=PW.checkchild(purmfdpno);
// string flagvalue=checkchild.Substring(0,1).Trim();
// if (flagvalue=="1" | flagvalue=="0")
// {
// string [] infoarray=checkchild.Split(new char[] { ';' });
// if (infoarray[0] =="1" )
// {
// this.PURMF_VENDOR.Text=infoarray[1].ToString().Trim().Trim();
// this.PURMF_DPNO.Text=infoarray[2].ToString().Trim().Trim();
// this.PURMF_QTY.Text=infoarray[3].ToString().Trim().Trim();

// this.ErrMsg.Text="";
// }
// else
// {
// this.ErrMsg.Text=infoarray[1].ToString().Trim().Trim();;
// this.PURMF_VENDOR.Text="";
// this.PURMF_DPNO.Text="";
// this.PURMF_QTY.Text="";
// }
// }
// else
// {
// this.ErrMsg.Text=checkchild;
// this.PURMF_VENDOR.Text="";
// this.PURMF_DPNO.Text="";
// this.PURMF_QTY.Text="";
// }
// }
// }


以上是用固定的文本框来显示的,可是现在传过来的数组不是固定的,而且要用table来显示就不知道怎么写啦呀,拜托拜托
wdzr_826 2007-12-10
  • 打赏
  • 举报
回复
web还是windows
xxxxxxxxYYYYY 2007-12-10
  • 打赏
  • 举报
回复
这个应该简单吧,利用Split函数分割吧

 string _str = "kk,qq;11,22";
string[] param1=_str.Split(';');

string[] param2;
for (int i = 0; i < param1.Length; i++)
{
param2=param1[i].Split(',');
MessageBox.Show(param2[0]);
MessageBox.Show(param2[1]);
}


具体的自己琢磨一下吧
ASP_sem 2007-12-10
  • 打赏
  • 举报
回复
没有人教我55555

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧