如何选择从列表框添加项目到数组。 [英] how to select add an item from list box to array.

查看:96
本文介绍了如何选择从列表框添加项目到数组。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  for (i =  0 ; i< =  26 ; i ++)
{
array [i] = /// ...根据i的值选择的列表框项目。
}



plz给我代码..



已添加代码块[/编辑]

解决方案




试试这个:

  for (i =  0 ; i< =  26 ; i ++)
{
array [i] = listbox1.Items.Item [i]; // 将listbox1更改为列表框的名称
}



希望这有帮助。


  for (i =  0 ; i< =  26 ; i ++)
{
array [i] = itemsListBox.Items [i] .ToString(); // (考虑数组为整数数组)
}


  for  int  i =  0 ; i <  itemsCount; i ++)
items [i] = itemsListBox.Items [I]的ToString();


for(i=0;i<=26;i++)
{
array[i]= ///...listbox item to be selected according the value of i..
}


plz give me code ..

[Edit]Code block added[/Edit]

解决方案

Hi,

Try this:

for(i=0;i<=26;i++)
{
array[i] = listbox1.Items.Item[i]; // change listbox1 into the name of your list box
}


Hope this helps.


for(i=0;i<=26;i++)
{
array[i]= itemsListBox.Items[i].ToString(); //(considering array is integer array )
}


for (int i = 0; i < itemsCount; i++)
    items[i] = itemsListBox.Items[i].ToString();


这篇关于如何选择从列表框添加项目到数组。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆