Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

Should be simple but I'm stuck!

I want to retieve the selected text of a DBGrid-field.

The field contains a number of words and I want to select one of them and then click on "Filter" to filter out records containing that word (in that field) but I cannot get the selected text.

 

Any help or directions appreciated

/Kejpa

Posted

Check out the DataGrids section at Windows Forms FAQ . There are examples there for doing just about anything programmatically you would like to a DataGrid.

There are several ways for filtering out the records containing the word once you retrieve it.....

If the underlying DataTable contains a column of one-word values, and this is the column you need to filter on, just use the RowFilter property:

tblData.DefaultView.RowFilter = "columnName = word";

If column you need to filter on contains multi-word values, you can use an Expression as a RowFilter:

tblData.DefaultView.RowFilter = "columnName LIKE '*word*'";

For references on both of these solutions see the MSDN documentation on DataViews.

Your final choice is to code the filtering yourself....using loops and flags or whatever you can dream up. ;)

 

Hi,

Should be simple but I'm stuck!

I want to retieve the selected text of a DBGrid-field.

The field contains a number of words and I want to select one of them and then click on "Filter" to filter out records containing that word (in that field) but I cannot get the selected text.

 

Any help or directions appreciated

/Kejpa

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...