views:

87

answers:

1

BindingSource.Filter property is doesn't work while i filter with the unicode characters. any soluctoion for that? or how to implement custom BindingSource to use correct filter property.

A: 
    private void filter()
    {
        try
        {
            BindingSource bs = null;
            if (dgvData.DataSource.GetType() == typeof(BindingSource))
            {
                bs = dgvData.DataSource as BindingSource;
            }

            if ((txtFilterValue.Text.Trim().Length > 0) && (cboFilterField.Text.Trim().Length > 0) && (bs != null))
            {
                //"က ခ ဂ".StartsWith("က"); //true
                bs.Filter = "CONVERT([" + cboFilterField.Text + "], System.String) LIKE CONVERT('" + txtFilterValue.Text.Trim() + "%" + "', System.String)";
                //bs.Filter = "[" + cboFilterField.Text + "] LIKE '" + txtFilterValue.Text.Trim() + "%'";
            }
            else
            {
                bs.Filter = "";
                txtFilterValue.Text = "";
            }
        }
        catch (Exception e)
        {
            System.Console.WriteLine(e.Message);
        }
    }

check above method. it's worked for en/us encoding. but doesn't work on myanmar unicode. i just use ZawGyi_One unicode font. [ က ခ ဂ ... ]. String comparison is correct //"က ခ ဂ".StartsWith("က"); //true. so i want to know detail about filter property and how to customize for that..

mr.gobbolino