Getting SelectedText/Item from ComboBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ASP Yaboh

    #1

    Getting SelectedText/Item from ComboBox

    I have a WinForm ComboBox that is populated by binding to a dataset that
    contains a list of employees (two columns: 1. employee id, 2. employee name).
    The id is bound to the ValueMember, the name to the DisplayMember. The
    dataset is then disposed.

    When an item is selected from the combobox, the value is easy to get. Yet
    when I try to capture the selected text I get a "DataRowVie w" back. I've
    tried to work my way through the DataRowView but I keep hitting a wall. Is
    there a simple way to access the selected DisplayMember? It shouldn't be this
    difficult.

    Thank you
  • Mythran

    #2
    Re: Getting SelectedText/Item from ComboBox


    "ASP Yaboh" <ASPYaboh@discu ssions.microsof t.com> wrote in message
    news:E68F0D7F-1110-461B-8FAD-3064A5F5AA66@mi crosoft.com...[color=blue]
    >I have a WinForm ComboBox that is populated by binding to a dataset that
    > contains a list of employees (two columns: 1. employee id, 2. employee
    > name).
    > The id is bound to the ValueMember, the name to the DisplayMember. The
    > dataset is then disposed.
    >
    > When an item is selected from the combobox, the value is easy to get. Yet
    > when I try to capture the selected text I get a "DataRowVie w" back. I've
    > tried to work my way through the DataRowView but I keep hitting a wall. Is
    > there a simple way to access the selected DisplayMember? It shouldn't be
    > this
    > difficult.
    >
    > Thank you[/color]

    Isn't it something like:

    cboBox.Items[cboBox.Selected Index].Text

    ??

    HTH,
    Mythran

    (P.S. Not sure, I haven't created winform app in a long time)

    Comment

    Working...