Results 1 to 3 of 3

Thread: VB.NET RowFilter in DataGridView

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    115

    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
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    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)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    115

    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
  •  



Click Here to Expand Forum to Full Width