CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    1

    multiple rowfilter help please

    i have the rowfilters running functioning individually but now i want to make one button that will pick up all 3 values and rowfilter that way, here is what i have, im pretty sure im goign to need some if/then's to get these 3 criteria to work togather, any help is appreciated!

    private void btnSchoolFilter_Click(object sender, System.EventArgs e)
    {
    objdsStudents.Tables["students"].DefaultView.RowFilter = "schoolID =" + this.comboBox5.SelectedValue.ToString();
    this.dataGrid1.Refresh();
    }

    private void button3_Click(object sender, System.EventArgs e)
    {
    objdsStudents.Tables["students"].DefaultView.RowFilter = "diabetes = 0";
    this.dataGrid1.Refresh();
    }

    private void button4_Click(object sender, System.EventArgs e)
    {
    objdsStudents.Tables["students"].DefaultView.RowFilter = "zip =" + this.zipfilter.Text.ToString();
    this.dataGrid1.Refresh();
    }

  2. #2
    Join Date
    Jul 2004
    Posts
    45

    Re: multiple rowfilter help please

    You can use AND and OR to concat the RowFilters.
    something like this...
    objdsStudents.Tables["students"].DefaultView.RowFilter = "(schoolID = " + this.comboBox5.SelectedValue + ") AND diabetes = 0 AND zip = " + this.zipfilter.Text;

    HTH.
    Maqsood Ahmed - MCAD.net
    Kolachi Advanced Technologies
    http://www.kolachi.net/web/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured