Dialogue Parameter for ListBox or ComboBox

Hi
Can I've the complete code please and steps
I've a combo box . showing all the Regions which I like to select but ,It only allow me to select one.
firstly does the ComboBox allow to select Multiple values If Yes please adivse How ?

If not I can ListBox but can I've the code with the choice if the user can select 'All Regions' or 'Specific'
wrote:
If RegionRadioButton.Checked = True Then
i = RegionNameComboBox.SelectedIndex
RegionID = RegionIDComboBox.Items.Item(i)
MsgBox(RegionID)
Report.SetParameterValue("RegionID", RegionID)
MsgBox("LastCheck",RegionID)
End IF
The following is the legacy code where if the user select 'All region' (AllCompanyRadioButton) it use hard code values but ELSE select multiple values and its work fine shown below which is , appreciate if any simple code for this
wrote:
If AllCompanyRadioButton.Checked = True Then
Report.SetParameterValue("RegionsByte", "15,14,13,12,99,88,77......................")
Else
Dim RegionIDString As String = ""
Dim RegionDescString As String
Dim i As Integer
Dim x As Integer
Dim y As String

For i = 0 To (RegionListBox.SelectedItems.Count - 1)
x = RegionListBox.SelectedIndices(i)
y = RegionIDListBox.Items.Item(x)
If i = 0 Then
RegionDescString = RegionListBox.SelectedItems(i)
RegionIDString = y
Else
RegionDescString = RegionDescString & ", " & RegionListBox.SelectedItems(i)
RegionIDString = y & ", " & RegionIDString
End If
Next
Report.SetParameterValue("RegionsByte", RegionIDString)
Report.SetParameterValue("RegionsDescParam", RegionDescString)
'### END - Identifies which region codes have been selected then assigns corresponding
'### region ID, puts into a delimited string to pass back to SQL as parameter.
End If


Many thanks

Comments

  • edited 5:56PM
    The Issue in IF condition
    wrote:
    If AllCompanyRadioButton.Checked = True Then
    Report.SetParameterValue("RegionsByte", "15,14,13,12,99,88,77......................")

    Before Else
    How can I avoid the hard coded values 15,,14..... and so on . As once the values added into Reference table it not good habbit to add into code as well?
    hope make sense please feel free to ask any question if it doesn't make sense.
    Many thanks
    Farhan

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.