首页 新闻 会员 周边 捐助

通过字符串操作取出,放入ArrayList类中,并绑定到ListBox控件中。

0
[已解决问题] 解决于 2009-05-12 20:47
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">已知字符串</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">001870028500698005680036300476</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">,其含义是三位的学生编码</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">+</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">两位的学生成绩,学生成绩在</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">1</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">到</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">99</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">之间。上述串的含义是:编号</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">001</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">成绩</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">87</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">,编号</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">002</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">成绩</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">85</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">,编号</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">006</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">成绩</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">98</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">。。。</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">请将成绩通过字符串操作取出,放入</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">ArrayList</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">类中,并绑定到</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"><span style="font-family: Times New Roman;">ListBox</span></span><span style="font-size: 14pt; font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">控件中。</span><span style="font-size: 14pt; mso-bidi-font-size: 12.0pt;" lang="EN-US"></span></p>
ゞ儍Dě溡尚的主页 ゞ儍Dě溡尚 | 菜鸟二级 | 园豆:210
提问于:2009-05-11 19:55
< >
分享
最佳答案
0

       第一步:取成绩

            string str = "001870028500698005680036300476";
            ArrayList aList = new ArrayList();

for (int i = 0; i < (str.Length/5); i++)
            {
            string str1=str.Substring(3+5*i, 2);
            //Console.WriteLine(str1);

     
            aList.Add(str1);//将成绩放入Arraylist: 
            }

第二步:绑定到listbox:

       ListBox.dataSource=aList;

       ListBox.dataBind();

Jaryleely | 菜鸟二级 |园豆:367 | 2009-05-12 00:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册