kejpa Posted May 24, 2004 Posted May 24, 2004 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 Quote
RobEmDee Posted May 25, 2004 Posted May 25, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.