VB.NET RowFilter in DataGridView-VBForums
Results 1 to 3 of 3

Thread: VB.NET RowFilter in DataGridView

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    75

    VB.NET RowFilter in DataGridView

    Hi


    I am tray to use RowFilter in DataGridView I have Address and Postal code try to search need little help with this Please
    need to search Address but sometime I seed Postal code if the list is to big


    Code:
    dt.DefaultView.RowFilter = Cbo_Address_filter.Text + " " + "LIKE '%" + Txt_Address_string.Text + "%'" And Cbo_Postal_code_filter.Text + " " + "LIKE '%" + Txt_Postal_code_string.Text + "%' "
    Regards
    ssalomon

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    96,598

    Re: VB.NET RowFilter in DataGridView

    That is terrible code I'm afraid. It's hard to read and that is exactly why you have botched it and can't see it. Learn to use String.Format:
    vb.net Code:
    1. String.Format("{0} LIKE '%{1}%' AND {2} LIKE '%{3}%'",
    2.               Cbo_Address_filter.Text,
    3.               Txt_Address_string.Text,
    4.               Cbo_Postal_code_filter.Text,
    5.               Txt_Postal_code_string.Text)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    75

    Re: VB.NET RowFilter in DataGridView

    Thanks jmcilhinney will check this out with String.Format

    ssalomon

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.