can llblGenPro "trim" a string value?

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 11-Mar-2006 18:22:50   

hiya,

I'm using the latest llblGenPro and binding an entityCollection to a winforms 2.0 datagidView.

The entityCollection datasource is an sqlServer nchar(15) field.

I'm having trouble because the item in the datagridView contains a trailing space.


 foreach (DataGridViewRow row in this.dgvDeliveryProducts.Rows)
                {
                    TblDeliveryProductsEntity product = new TblDeliveryProductsEntity();

                    product = (TblDeliveryProductsEntity)row.DataBoundItem; 

                    if (product != null)
                    {
                        string barCode;
                        barCode = txtBarcode.Text;

                        
                        if (product.BarCode == barCode)   
                        //can I "trim" the  product.BarCode?                        


Many thanks,

yogi

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 11-Mar-2006 19:28:11   

You could try something like this (copied from MSDN)

class stringTrim2 {
    public static void Main() {
        String str1 = "*;|@123***456@|;*";
    String delim = "*;|@";
    String str2 = str1.Trim(delim.ToCharArray());

    Console.WriteLine("Delimiters:      {0}", delim);
    Console.WriteLine("Original string: {0}", str1);
    Console.WriteLine("Trimmed string:  {0}", str2);
    }
}

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 12-Mar-2006 14:27:10   

cheers Sparmar,

i just asssigned the property of the entity to a string and compared it. I can't believe that VS2005 / sqlServer don't provide this functionality.

yogi

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 12-Mar-2006 16:47:20   

yogiberr wrote:

cheers Sparmar,

i just asssigned the property of the entity to a string and compared it. I can't believe that VS2005 / sqlServer don't provide this functionality.

yogi

Well that is one way of doing the job. wink but you never know. some else might come up with another method.