Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected Sir Plz Help me.

I have some keywords in a table with field name "ID" and "Keywords". I want to give a sentence through a "TextBox" control, if that words of the sentences will match as the "Keyword fields" of the above table ,then it will display that rows of the table in "datagridview" Control.

Kindly Help me sir its very necessary.
Posted
Updated 4-Apr-11 0:02am
v2

1 solution

One way to do this would be to either load your table into a DataTable and iterate over it's Rows collection, or Read the table using a DataReader to get each keyword in turn.

Using each keyword it is fairly simple to do something like:
C#
if (myTextBox.Text.Contains(theKeyword))
{
  // add that DataRow to a new DataTable (myMatchedDataTable)
}

// after iterating over all records
myDataGridView.DataSource = myMatchedDataTable;
 
Share this answer
 
v2
Comments
manasBonton 4-Apr-11 6:29am    
kindly write briefly,i am new in coding
Henry Minute 4-Apr-11 8:27am    
If you lookup the highlighted words in MSDN you will find example code.

You should be able to get enough from those examples and my previous reply to attempt a solution.

If you are unable to do that and are that new in coding then this task is probably too complex for your current level. In that case you should bet a book on the Basics of C# and work through the examples.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900