ccgt ccgt - 1 year ago 205
C# Question

show slow array into textbox c#

show slow textbox array ie display the item and wait a few seconds to display the following c #

Answer Source

Let's say you want the values of the first column, which will have the index 0.

PS : It's better to do it with a for rather than a for each, since you want to add the values into an array, without an index (or an additional value) you'll have to write more code.

int[] b = new int[datagridview1.Rows.Count];
for (int i = 0; i < datagridview1.Rows.Count; i++)
    b[i] = datagridview1.Rows[i].Cells[0].Value == null ? -1 : Convert.ToInt32(datagridview1.Rows[i].Cells[0].Value);
    // the ?: is to check weither the value is null or not, then asign -1 if it's null
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download