Results 1 to 3 of 3

Thread: combobox

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    combobox

    Hi,
    At present I am populating a combo box in winform .net 2.0
    It is populated using something like the following method:

    cbo.datasource=dataTable
    .datamember=
    .valuemember=

    How can I add an empty item in the very first item
    I tried something like:
    cbo.items.add("") before the .datasource line, but no change.

    This is required so that when the form loads, the combobox is populated but no item should be shown.
    Thanks

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: combobox

    are you using bindingSource in your project?
    if yes you might want to try setting the bindingSource position property to -1
    VB Code:
    1. myBindingSource.Position = -1

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: combobox

    Set the combobox.selectedindex = -1 AFTER the databinding stuff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width