how can I find a row position

  • Thread starter Thread starter fanor
  • Start date Start date
F

fanor

Hi guys,

I have a form with many controls bound to a table.
To find some especific record in that table I use a dataview. The find
method give a index of the record on the view not in the table, so now I
want to find that record in the table because I want that record to be
show in the controls bound to the table.

Any help I'll apreciate a lot
 
William said:
You can walk through the dataview (it's easy to just set the rowfilter and
then you'll only have the records you want in there).

http://www.knowdotnet.com/articles/iteratingdataview.html


yeah, but i don't just to walk througt.
What I want is to look up for one record in the table, and the controls
are bound to the table not to the dataview. I use de dataview just to
locate that record.

I tried to bound the controls to the dataview, but I found some problems
and for that I bound to the table directly.
 
Ok, there's .Find, .FindRows (dataView) and .Select (DataTable) that you can
use instead. With that said, the view is a pretty good approach most of the
time, if you don't mind me asking - what sort of stuff did you run into w/
it?

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Hi Fanor,

You can simply assign the value from the dataview
(dvue("storename")(ifind)). Another approach would be to use the
defaultview of the datatable itself, which also provides a find method, and
so avoid the step of the dataview entirely.

HTH,

Bernie Yaeger
 
But how do You set the BindingContext[].Position based on the .Find method?

Best regards,

Benny Tordrup
 
Hi guys,


I used both approaches, dataview and a default dataview. In both cases I
got an index to access the record without problem.
But, I want that record to be shown through the controls (remember the
controls are bound to the table directly,) it means I have to set the
databinding[].position of the table to that record,; however, the index
is for the dataview, so

databinding[mytable].position = index

doesn't work because the order of the records in the table and the
dataview are not the same.

The user should be able to navigate 1 by 1 the records or be able to
go directly to a record with phone# ="xxxxxxx", also can insert, delete,
and edit the records.


Another approach is to sort the table by phone#. But when the user
inserts a new record the table should be resorted, wich seems to be
inefficient because all the records must be read again from the
datastore (which is residing in a server.)

The solution to this problems should be to bind the controls to a
dataview, but not all of this controls can be bound to a dataview!!. At
least I got many problems when I tried to bind them.

I will apreciate a lot any sugestion with a different approach
 
Back
Top