|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Silly combo box questionHi,
I've looked over and over and in MSDN 2005 and just can't find what is a really simple answer. How do I select the first value in a combo box to be shown? I tried the .selectedindex -1 but it doesn't work. At the moment it populates fine but it just remains blank unless I dropdown the list. Thanks, Adam "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schrieb: Set the 'SelectedIndex' property to 0. Setting it to -1 causes no item to > I've looked over and over and in MSDN 2005 and just can't find what > is a really simple answer. > > How do I select the first value in a combo box to be shown? > I tried the .selectedindex -1 but it doesn't work. > > At the moment it populates fine but it just remains blank unless I > dropdown the list. be selected, which is indicated by the blank combobox. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Misreaded your answer therefore I did it again.
Sorry Cor Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:%23zqY6MScGHA.380@TK2MSFTNGP04.phx.gbl... > "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schrieb: >> I've looked over and over and in MSDN 2005 and just can't find what >> is a really simple answer. >> >> How do I select the first value in a combo box to be shown? >> I tried the .selectedindex -1 but it doesn't work. >> >> At the moment it populates fine but it just remains blank unless I >> dropdown the list. > > Set the 'SelectedIndex' property to 0. Setting it to -1 causes no item to > be selected, which is indicated by the blank combobox. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> Adam,
The first is 0 as most things that are derived from classic VB. If you want an empty box by not binded data than you can use -1. I hope this helps, Cor Show quoteHide quote "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schreef in bericht news:%23gSqZGScGHA.4892@TK2MSFTNGP02.phx.gbl... > Hi, > > I've looked over and over and in MSDN 2005 and just can't find what > is a really simple answer. > > How do I select the first value in a combo box to be shown? > I tried the .selectedindex -1 but it doesn't work. > > At the moment it populates fine but it just remains blank unless I > dropdown the list. > > Thanks, > Adam > Thanks guys, 0 it is and works like a charm.
Adam Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%237BakYScGHA.1208@TK2MSFTNGP04.phx.gbl... > Adam, > > The first is 0 as most things that are derived from classic VB. > > If you want an empty box by not binded data than you can use -1. > > I hope this helps, > > Cor > > "Adam Honek" <AdamHo***@Webmaster2001.freeserve.co.uk> schreef in bericht > news:%23gSqZGScGHA.4892@TK2MSFTNGP02.phx.gbl... >> Hi, >> >> I've looked over and over and in MSDN 2005 and just can't find what >> is a really simple answer. >> >> How do I select the first value in a combo box to be shown? >> I tried the .selectedindex -1 but it doesn't work. >> >> At the moment it populates fine but it just remains blank unless I >> dropdown the list. >> >> Thanks, >> Adam >> > > > Adam, Unless you are talking Dotnet 1.x and currently have a value selected. In > > The first is 0 as most things that are derived from classic VB. > > If you want an empty box by not binded data than you can use -1. that case, you need to set it to -1 twice (or sometimes 3 times). Actually, I think the implementation in 2.0 sets the selectedindex to 0 then -1 if you try to set it to -1 when it is currently > 0, which effectively means that unselecting a value will cause a value to be selected temporarily and then unselected. This to me is more silly than the original question which has already been answered. Jim Wooley http://devauthority.com/blogs/jwooley/default.aspx
How getting eventhandler attached to an event?
Simple word count Win32API - FindFirstFile() in VB.NET Threading so restricted? single to string problem Variable with other variable My app as system process Simple TCP communications examples Thread terminating instantly How to move the mouse around in vb.net |
|||||||||||||||||||||||