2 Replies - 4596 Views - Last Post: 13 June 2008 - 07:50 AM Rate Topic: -----

#1 katuil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-June 08

Data Bound Combo Box

Posted 12 June 2008 - 03:53 PM

I have a VB.Net 2008 Windows Application that I need to get some help with. I am using the built in data binding tools to get to a SQL 2005 database. On my form I have it bound to the database and have several controls including combo boxes for looking up state and zip codes. The lookup tables have multiple fileds. For the states there are two fields: StateID and StateName. I have relationships using the StateID. On the conbo box I have it bound to lookup data from the state lookup table. The save code is the generated code from VS, nothing complex at all. The error I get is that the MaxLength for StateFK has been violated. Now on the combo box the Display Member and Select Value items are set (i think properly). What I think is happening is that the combobox.text value is what is getting inserted into the data bound field that is bound to the form. I can post images of the form as to how the combo box is setup if needed. Thanks

John

Is This A Good Question/Topic? 0
  • +

Replies To: Data Bound Combo Box

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Data Bound Combo Box

Posted 12 June 2008 - 08:34 PM

Can you post the exact error message that you are getting?
Was This Post Helpful? 0
  • +
  • -

#3 katuil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-June 08

Re: Data Bound Combo Box

Posted 13 June 2008 - 07:50 AM

The handle is 'ArgumentException was unhandled'. Then the text is: Cannot set column 'txtState'. The value violates the MaxLength limit of this column.

Now txtState is the field that the combo box is bound to. From what I can tell, the value that is trying to get put into txtState is the combobox.text value which does exceed the limit of MaxLength. The value that should be inserted is Value Member from the lookup table or the Selected Value. Both of these I have tried to set and in either case I get the same error. Now if I take the Display Member and change it to the Value Member everything works fine.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1