OK I AM Dumb

I must be because what I'm trying to do will not work.

I have a table (Fruit) containing an ID (Identity)and a description(Apple, Banana etc..) so
1= Apple
2= Banana
etc...

I have a table (containing other info plus a column for the fruit ID

I have a form with a dropdown to select the fruit to add

Now heres where I go stupid...

I need the combobox to show the item description from the first table (Apple) but stamp the ID(1) into that column.

I have manged to bind the combo to the fruit table but once the selection changes the app locks up and the record isnt saved.

I have hunted the help, msdn but this must be something so basic that its not published anywhere.
So how do i do this




Answer this question

OK I AM Dumb

  • Krodinjw

    OK- I had sort of worked out the bindings out as far as displaying <but> how do I get it to update the field with the id number

    There is no code as such I just used the combobox tasks, 'use databound items' checkbox.

    I guess what I'm trying to do is what Access combo's do where you display a description but the bound data column (in this case an ID number) gets entered into the tables field.



  • Yuriy H

    I am using details view.

    Is this something that no-ones does or something   I am a bit surprised by the lack of answers as I thought everyone would be going "you stoopid person, do this...' and would be something people do all the time in VB ( I know I do in Access anyways) I was trying to do it properly but as this looks like a no-goer I guess I'll just have to store the text values instead.



  • Dario_Bello

    is this a web page

  • Brian Crawford MSFT

    ohhh you mean the column that lookup to other table to retrieve human readable data instead of id's do you want to use datagridview control , i was searching for that but i got nothing like that, i can code that but not in datagridview

    best regards



  • Andre's

    *grin* I appreciate the self deprecating humour, but if you put something in your header that describes your problem, it really does help attract people who can help.

    http://www.thescarms.com/dotnet/BindCombobox.asp

    Basically, you can set a display member on the combo box when you data bind, and a data member. The display member is the string, the data member is the ID.

    However, do you have code that runs on the selection changed event I'd guess there is something wrong there, perhaps something which causes the event to refire, causing an infinite loop and a crash. Posting some code would help.



  • Vano

     

    Hi SHB,

    None of us has all the answers. The width and breadth of Dot Net is quite humbling and it's overwhelming at first even for very experienced programmers.

    I couldn't help but notice the self-denigration. I wanted to share in your support that I sure understand the feelings of being overwhelmed.

    Often we don't have time ...but take time... you will whether you want to or not. No valuable set of skills was acquired over night.

    Be gentle with yourself. Knowledge comes..... Wisdom follows.



  • OK I AM Dumb