BindingSource formatting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bplacker
    New Member
    • Sep 2006
    • 121

    #1

    BindingSource formatting

    Ok, so I'm opening a dataset, and creating a new bindingsource based on a dataset. Once I set the bindingsource, I fill a bunch of text boxes, checkboxes, and combo boxes with data from the bindingsource. I have a small problem though... when data is read in from the database, it reads in not just the data, but any spaces after it. For instance.. lets say I have a field called name in my database, which is of char(50). If the value in name is only 5 characters long, I would recieve a full 50 character string, the value + 45 spaces.
    Now this sounds fine, but where I encounter a problem is when I try to bind a combo box to the binding source... because the values in the combo box do not match the ones in the binding source, because of the extra spaces. So, I need something like...

    comboBox1.DataB indings.Add("Se lectedItem",bin dingsource,"Nam e".trim)

    or something?

    Does this make any sense whatsoever???
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Is the data being trimmed prior to entering the DB?

    Comment

    • bplacker
      New Member
      • Sep 2006
      • 121

      #3
      It was entered right out of a text box... what I mean is... the value in the text box was entered directly into the DB. Maybe this is just a sql server thing? It sure is causing me some headaches though!

      Comment

      • bplacker
        New Member
        • Sep 2006
        • 121

        #4
        No ideas eh?

        Comment

        Working...