dataview find

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a datatable and am searching the column called File for a particular
value called xFile (a number).

DataView dv = new DataView(tCat, "", "File", DataViewRowState.CurrentRows);
int xrow = dv.Find(xFile);
MessageBox.Show(dv[xrow]["File"].ToString());

But the messagebox just shows xrow to be the value of xFile, not the row
it's in. What am I missing?

Thanks!
Mel
 
Oops again. I realized I pasted the wrong code. (Sorry! - it's been a long
week, not to mention my cold...) What's going on is that, instead of
highlighting the same row that was highlighted previous to a column header
click, a different row is highlighted. This row is the xFileth row (xrow
seems to become xFile). Hope this makes sense. Any help would be great,
especially since it seems that

int xrow = dv.Find(xFile);

should give me the row number that contains xFile (right?).

Mel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top