Click to See Complete Forum and Search --> : PB with ListBox


trevesp
March 27th, 2004, 04:13 PM
Hello,

I am writing a Morgage application in VB.NET under Windows XP.
I have a dialog box that I use to enter the Client parameter such as the Principal amount, Yearly salary and 2 listboxes to set the Number of Years and the Interest Rate of the Morgage.

I am having problems writing code that will set the initial value of the listbox to the previously entered or selected values.
I tried using the DisplayValue, SelectedValue methods but to no avail.

Any one has any ideas on the code snipet to do this task ?

Regards,

Paolo

Craig Gemmill
March 28th, 2004, 11:38 AM
ListBox1.SelectedIndex = 5

or

ListBox1.SelectedItem = "something"

Should do the job.

gasperCasper
March 28th, 2004, 12:07 PM
try

Listbox1.selectedvalue="something" 'if you set valuemember / displaymember properties for the listbox.