Results 1 to 3 of 3
  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2016

    Post how to make a datatable without case sensitive and show the result with only 4-5 char

    I've a filter, a datatable linked with a listbox and if statements, now i need to know, how can i say to program, when user search on datatable to don't care if a word is written with an upcase or lowcase character, and show the result when a few words at least is written into texbox? (like 4 or 5)

    This is the code:

     Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
            Dim dvtest As New DataView
            dvtest = dttest.DefaultView
            dvtest.RowFilter = "test Like '%" + TextBox1.Text + "%'"
            If dttest.Rows.Count >0 <2 Then
                For counter As Integer = 0 To dttest.Rows.Count < 3
                    If dttest.Rows(0).Item(0).ToString = TextBox1.Text Then
    End If
    I resolved it with this code, wasn't very hard sorry:
    TextBox1.Text = Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TextBox1.Text)
            TextBox1.SelectionStart = TextBox1.TextLength
    Now i want to know, how i can show the result of an if statement with at least 2 or 5 words without trim the left text ? I tried with this code:

    But with this, the Item of that row disappear, and only with a letter(wrong one), show the picture of that if(but i like the user just put 3 or 4 words for show the result of the if (the same of that row value without trim the others, to show the picture)
    Last edited by axel48; Mar 10th, 2016 at 05:17 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: how to make a datatable without case sensitive and show the result with only 4-5

    The String.Equals, String.StartsWith and String.EndsWith methods are all overloaded and allow you to specify whether the comparison should be case-sensitive or case-insensitive. You never need to change the case of anything in order to compare.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Join Date
    Oct 2010

    Re: how to make a datatable without case sensitive and show the result with only 4-5

    For the originally asked question see: DataTable.CaseSensitive Property

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