本文介绍了将组合框转换为字节,大于20个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于组合框的列表错误,值太大到太小我尝试将其转换为int64。



Int64 k = Convert.ToInt64(textBoxQuantity.Text) ;

Int64 j = Convert.ToInt64(cbxListSN.Text);



for(Int64 i = 0; i< k; i ++ )

{

SerialListBox.Items.Add(j + i + 1);

}



但它不起作用。我有20位数。



i需要将我的组合框和列表框转换为字节,因此它可能需要超过20个字符。



目前它只占用10个以上的字符。

但是我想放20个以上字符。

value was either Too large to too small for list error for combobox i tried converting it to int64.

Int64 k = Convert.ToInt64(textBoxQuantity.Text);
Int64 j = Convert.ToInt64(cbxListSN.Text);

for (Int64 i = 0; i < k; i++)
{
SerialListBox.Items.Add(j + i + 1);
}

but its not working. i have 20 digits.

i need to convert my combo box and listbox to bytes so it can take more than 20 characters.

currently its only taking lass than 10 characters.
but i want to put more than 20 character.

推荐答案

DataTable dtList = new DataTable();
dtList.Columns.Add("Value");
dtList.Columns.Add("Text");

Int64 k = Convert.ToInt64(textBoxQuantity.Text);
Int64 j = Convert.ToInt64(cbxListSN.Text);

for (Int64 i = 0; i < k; i++)
{
DataRow dr = dtList.NewRow();
dr["Value"] = i;
dr["Text"] = j + i + 1;
dtList.Rows.Add(dr);
}
SerialListBox.DataSource = dtList;


这篇关于将组合框转换为字节,大于20个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 06:45