'Incremental Search' of data base or "Wheres the 'Seek' method

T

Terry

Hi,
I am both new to .Net (coming from VB6 and DAO) and to this news group. I
am trying to convert some code from VB6 that uses a "record set" to help the
user locate a specific record.
As the user types into a text box, the grid position changes.
example:

rs.index = "CompanyName"
..
..
..
Private Sub txtCompanyName_Changed()
rs .seek ">=", txtCompanyName.Text
..
..
..
I not only can't find a "seek" function for a table in a dataset, I can't
find any mention of an index for a table in a dataset! Am I missing
something? I hope the solution is not that I have to issue a new SELECT
with a sort by clause and then a loop with a move next statement!

Any help would be greatly appreciated!
Terry
 
C

Cor Ligthert [MVP]

Terry,

If you are used to recordset, than don't try to compare them with datasets.
The datatable is the most neares.

A datatable hold datacolumns and datarows.

The datacolumns describes the items in a datarow
Every datarow has data items.

And than we have very much methods where ADO has one
There is the
DataView rowfilter
DataView find
DataTAble select
DataRowCollection find
And more

http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection.find.aspx

I think that the one above meets the solution to your current problem the
most.

I hope this helps,

Cpr
 
R

Ralph

Terry said:
Hi,
I am both new to .Net (coming from VB6 and DAO) and to this news group. I
am trying to convert some code from VB6 that uses a "record set" to help the
user locate a specific record.
As the user types into a text box, the grid position changes.
example:

rs.index = "CompanyName"
.
.
.
Private Sub txtCompanyName_Changed()
rs .seek ">=", txtCompanyName.Text
.
.
.
I not only can't find a "seek" function for a table in a dataset, I can't
find any mention of an index for a table in a dataset! Am I missing
something? I hope the solution is not that I have to issue a new SELECT
with a sort by clause and then a loop with a move next statement!

Any help would be greatly appreciated!
Terry

--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic version 6.0
and earlier and not the misleadingly named VB.Net
or VB 200x. Solutions, and often even the questions,
for one platform will be meaningless in the other.
When VB.Net was released Microsoft created new newsgroups
devoted to the new platform so that neither group of
developers need wade through the clutter of unrelated
topics. Look for newsgroups with the words "dotnet",
"framework", or "vsnet" in their name.

For the news.microsoft.com news server try these:

news://msnews.microsoft.com/
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.windowsforms.databinding
</response>
 
T

Terry

Hi,
I do not wish to "filter " the results, I want to position the current
row. The 'find' method requires that I already know the value being
sought, which obviously is not the case. For example,
when the
user type 'M' in the text box, I want the top row of the DataView to be the
first company name that starts with 'M' and when he then types a 'i' I want
the top row to be the first entry that starts with 'Mi' etc. If no such
entry exists, the DataView would still be positioned at the first record
starting with 'M' as opposed to having an empty DataView, which would be the
result of setting a filter for the first 2 characters of company name being
"Mi".
So, I ask again, how do I quickly "position" the datagridview?
 
C

Cor Ligthert [MVP]

Terry,

Sorry but "postition" in Net means the place that a row has inside its
collection, which is showed or whatever.

"Sort" means to set them in a special sequence,

I cannot change the used terminology

Therefore do you need a position or do you want to show the rows in a
special sorted way.

The DataGridView has no position but has a rowindex.

Cor
 

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

Top