hi everyone in this article i have shown how to fetch text box value or words or characters and use it like array
means to fetch all value which has entered in text box and then restore each single value into array.
what i did i just took text box value into string and had count length of string will be max array length so there be
no index-out of range error will be come.
then using for loop count length and store each single value into array.
here is code
string stringarrayvalue=Txtmytextboxvalue.text
int[] aarr=new int [Txtmytextboxvalue.Text.Length];
//or u can take int[] aarr=new int [stringarrayvalue.Length]; both will work
for (int i = 0; i < stringarrayvalue.Length; i++)
{
aarr[i] =Convert.ToInt32(stringarrayvalue[i].ToString());
Label lbli = new Label();
lbli.Text = aarr[i].ToString();
dvlabl.Controls.Add(lbli);
// took dynamic lable to display value
}
this code is working fine.just copy and paste it .but label is dynamic u can take asp label.
means to fetch all value which has entered in text box and then restore each single value into array.
what i did i just took text box value into string and had count length of string will be max array length so there be
no index-out of range error will be come.
then using for loop count length and store each single value into array.
here is code
string stringarrayvalue=Txtmytextboxvalue.text
int[] aarr=new int [Txtmytextboxvalue.Text.Length];
//or u can take int[] aarr=new int [stringarrayvalue.Length]; both will work
for (int i = 0; i < stringarrayvalue.Length; i++)
{
aarr[i] =Convert.ToInt32(stringarrayvalue[i].ToString());
Label lbli = new Label();
lbli.Text = aarr[i].ToString();
dvlabl.Controls.Add(lbli);
// took dynamic lable to display value
}
this code is working fine.just copy and paste it .but label is dynamic u can take asp label.
0 comments: