|
-
May 2nd, 2013, 01:08 PM
#1
Thread Starter
Member
Setting ListBox1.selectedindex to match a variable.
I have poked around the web and forums and found no help.
I have tried a couple of different ways in code but no joy on a solution to my prob.
Here is it, I present the user with a ListBox1 of all "reporting periods" for the year to select from but I would like the the "current" period to be the selected index so the user can just click "SELECT" or select a differnet and click select.
The Current period is stored in a Public Variable (CurrReportPeroidKey)
the listbox has all the periods listed
DisplayText = Period Description
SelectedValue = ReportPeriodKey
I would like to do somethinglike,
Set listbox1.selectedindex where listbox1.value = currReportPeriodKey.
Is there there a way to sift through the all the values in the listbox and find the index that matches the value to my stored variable value?
the listbox1 is populated via a database table of period.
I tried something like this..
For Each Item In ListBox1.SelectedValue
If Item.ListBox1.SelectedValue = CurrReportPeroidKey Then
LBindex = Item.ListBox1.SelectedIndex
End If
Next
Last edited by gmack; May 2nd, 2013 at 01:18 PM.
Reason: add
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|