Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: datagridview Pin
Harvey Saayman7-Dec-08 20:59
Harvey Saayman7-Dec-08 20:59 
GeneralRe: datagridview Pin
tasumisra7-Dec-08 21:04
tasumisra7-Dec-08 21:04 
GeneralRe: datagridview Pin
Harvey Saayman7-Dec-08 21:10
Harvey Saayman7-Dec-08 21:10 
GeneralRe: datagridview Pin
tasumisra7-Dec-08 21:13
tasumisra7-Dec-08 21:13 
GeneralRe: datagridview Pin
Harvey Saayman7-Dec-08 21:17
Harvey Saayman7-Dec-08 21:17 
GeneralRe: datagridview Pin
tasumisra7-Dec-08 21:39
tasumisra7-Dec-08 21:39 
GeneralRe: datagridview Pin
Harvey Saayman7-Dec-08 21:48
Harvey Saayman7-Dec-08 21:48 
AnswerRe: datagridview Pin
Lev Danielyan7-Dec-08 20:51
Lev Danielyan7-Dec-08 20:51 
Hi,

Why don't you use the BindingSource Filter property?

For example, you can have myDataSource.Filter = "City = 'DOWNTOWN'"

Here is the example from MSDN:

private void PopulateDataViewAndFilter() {
DataSet set1 = new DataSet();

// Some xml data to populate the DataSet with.
string musicXml =
"" +
"<music>" +
"<recording><artist>Coldplay<cd>X&Y" +
"<recording><artist>Dave Matthews<cd>Under the Table and Dreaming" +
"<recording><artist>Dave Matthews<cd>Live at Red Rocks" +
"<recording><artist>Natalie Merchant<cd>Tigerlily" +
"<recording><artist>U2<cd>How to Dismantle an Atomic Bomb" +
"";

// Read the xml.
StringReader reader = new StringReader(musicXml);
set1.ReadXml(reader);

// Get a DataView of the table contained in the dataset.
DataTableCollection tables = set1.Tables;
DataView view1 = new DataView(tables[0]);

// Create a DataGridView control and add it to the form.
DataGridView datagridview1 = new DataGridView();
datagridview1.AutoGenerateColumns = true;
this.Controls.Add(datagridview1);

// Create a BindingSource and set its DataSource property to
// the DataView.
BindingSource source1 = new BindingSource();
source1.DataSource = view1;

// Set the data source for the DataGridView.
datagridview1.DataSource = source1;

source1.Filter = "artist = 'Dave Matthews'";
}

Regards,
Lev

AnswerRe: datagridview Pin
Harvey Saayman7-Dec-08 20:55
Harvey Saayman7-Dec-08 20:55 
AnswerRe: datagridview Pin
V.7-Dec-08 21:12
professionalV.7-Dec-08 21:12 
Questionhow to show selected column in DataGridView ? Pin
Ravi Munde7-Dec-08 19:23
Ravi Munde7-Dec-08 19:23 
AnswerRe: how to show selected column in DataGridView ? Pin
Tony Pottier7-Dec-08 19:25
Tony Pottier7-Dec-08 19:25 
QuestionSplash Screen Pin
Nalin Kodithuwakku7-Dec-08 19:03
Nalin Kodithuwakku7-Dec-08 19:03 
AnswerRe: Splash Screen Pin
dan!sh 7-Dec-08 20:54
professional dan!sh 7-Dec-08 20:54 
GeneralRe: Splash Screen Pin
Lev Danielyan7-Dec-08 21:41
Lev Danielyan7-Dec-08 21:41 
Questionreg non movement of web parts [modified] Pin
madeline_veda7-Dec-08 19:00
madeline_veda7-Dec-08 19:00 
AnswerRe: reg non movement of web parts Pin
Rutvik Dave8-Dec-08 8:28
professionalRutvik Dave8-Dec-08 8:28 
QuestionRe: reg non movement of web parts Pin
madeline_veda8-Dec-08 23:08
madeline_veda8-Dec-08 23:08 
AnswerRe: reg non movement of web parts Pin
Rutvik Dave9-Dec-08 3:46
professionalRutvik Dave9-Dec-08 3:46 
GeneralRe: reg non movement of web parts Pin
madeline_veda9-Dec-08 19:44
madeline_veda9-Dec-08 19:44 
QuestionDatagridview problem Pin
Richard Blythe7-Dec-08 18:12
Richard Blythe7-Dec-08 18:12 
AnswerRe: Datagridview problem Pin
Tony Pottier7-Dec-08 19:24
Tony Pottier7-Dec-08 19:24 
GeneralRe: Datagridview problem Pin
Richard Blythe8-Dec-08 4:12
Richard Blythe8-Dec-08 4:12 
QuestionAbout trojans, and other stealth programs Pin
nelsonpaixao7-Dec-08 14:24
nelsonpaixao7-Dec-08 14:24 
AnswerRe: About trojans, and other stealth programs Pin
EliottA7-Dec-08 16:31
EliottA7-Dec-08 16:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.