wsyeager Posted April 16, 2003 Posted April 16, 2003 When data is retrieved from my database and placed in a listbox, the first item is always selected. However, I do not want that behavior. How do you programatically unselect items in a listbox? I know how to do it using a webform listbox, but the windowsform listbox does not work the same way. Quote Thanks, Bill Yeager (MCP, BCIP) Microsoft Certified Professional Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer YeagerTech Consulting, Inc.
Cassio Posted April 16, 2003 Posted April 16, 2003 (edited) Try using listbox.selectedindex = -1 (I didnt test it) Edited April 16, 2003 by Cassio Quote Stream of Consciousness (My blog)
*Experts* DiverDan Posted April 17, 2003 *Experts* Posted April 17, 2003 (edited) Try ListBox1.ClearSelected() in your Form Load event after the listbox has been populated. It will clear the selection bar from the listbox on startup. Edited April 17, 2003 by DiverDan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.