calculate matrix from lists
good afternoon,
i'm trying create array, using data gridview.with code have works,
think can exists 1 solution better problem.
idea read table of users point of origin , 1 destination, in differents dates.
for example:
user1
id ap_source ap_destine
1 3 2
2 4 1
3 3 2
datagridap
1 2 3 4
1
2
3 2
4 1
aim know if there faster way want
datarow[] results_filter = comut.select("username=" + user);
list<string> ap_source = results_filter.asenumerable().select(x =>x["ap_source"].tostring()).tolist();
list<string> ap_destine = results_filter.asenumerable().select(x =>x["ap_destine"].tostring()).tolist();
int cont_list = ap_destine.count;
(int = 0; < cont_list; i++)
{
string v_source = ap_source[i].tostring();
string v_destine = ap_destine[i].tostring();
datagridviewrow row = datagridap.rows
.cast<datagridviewrow>()
.where(r => r.cells[0].value.tostring().equals(v_source))
.first();
int index_line_pivot_ap = row.index;
int index_column = datagridap.columns[v_destine].index;
//update cell
long value_cell = convert.toint32(datagridap.rows[index_line_pivot_ap].cells[index_column].value);
datagridap.rows[index_line_pivot_ap].cells[index_column].value = value_cell + 1;
thanks
i'm trying create array, using data gridview.with code have works,
think can exists 1 solution better problem.
idea read table of users point of origin , 1 destination, in differents dates.
for example:
user1
id ap_source ap_destine
1 3 2
2 4 1
3 3 2
datagridap
1 2 3 4
1
2
3 2
4 1
aim know if there faster way want
datarow[] results_filter = comut.select("username=" + user);
list<string> ap_source = results_filter.asenumerable().select(x =>x["ap_source"].tostring()).tolist();
list<string> ap_destine = results_filter.asenumerable().select(x =>x["ap_destine"].tostring()).tolist();
int cont_list = ap_destine.count;
(int = 0; < cont_list; i++)
{
string v_source = ap_source[i].tostring();
string v_destine = ap_destine[i].tostring();
datagridviewrow row = datagridap.rows
.cast<datagridviewrow>()
.where(r => r.cells[0].value.tostring().equals(v_source))
.first();
int index_line_pivot_ap = row.index;
int index_column = datagridap.columns[v_destine].index;
//update cell
long value_cell = convert.toint32(datagridap.rows[index_line_pivot_ap].cells[index_column].value);
datagridap.rows[index_line_pivot_ap].cells[index_column].value = value_cell + 1;
thanks
hi ricardo,
welcome msdn forum support.
we're doing research on issue. might take time before you.
sincerely,
jason wang
jason wang [msft]
msdn community support | feedback us
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment