I can get the value for the lookup at runtime:
Id = this.dgDevLkp[row, 3].ToString().TrimEnd();
I'm wondering if I can do something like this:
Id = this.dgDevLkp[row, columnName].ToString().TrimEnd();
Is this possible?
Why not use the DataGridViewColumn's Index
property?
Eg:
Id = this.dgDevLkp[row, columnName.Index].ToString().TrimEnd();
Where "columnName" is the name of your DataGridViewColumn.
Thanks for all suggestions
The following code worked for me
int ColumnIndex = this.dsDevLkp.Tables[dgtbsDevLkp.MappingName].Columns["ColumnName"].Ordinal;
Id = this.dgDevLkp[row, ColumnIndex].ToString().TrimEnd();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.