1
Answer

Adding combo box to MS Report Viewer ToolStrip

Matthew Coffin

Matthew Coffin

11y
3.9k
1
Hi - I am trying to use the MS Report viewer in a project. I have been able to add a combobox to the toolstrip of the reprt viewer, and I can detect the selectedindexchange event, but I do not understand how to get the indexvalue of the item selected in this combo box

Private

Dim ts() As Control = Me.ReportViewer1.Controls.Find("toolStrip1", True)

If ts IsNot Nothing ThenDim tsItem As ToolStrip = DirectCast(ts(0), ToolStrip)
Dim sep As New ToolStripSeparator
Dim Lab As New ToolStripLabel
Dim tscbo As New ToolStripComboBox
Dim tboxcbo1 As New ArrayList
tboxcbo1.Add(New mmtypevalues(0, "Todos"))
tboxcbo1.Add(New mmtypevalues(1, "Not Used"))
tboxcbo1.Add(New mmtypevalues(2, "Mandatory"))
tboxcbo1.Add(New mmtypevalues(3, "Supplied"))
tboxcbo1.Add(New mmtypevalues(4, "Optional"))
sep.Name =
"sep1"
sep.Alignment = ToolStripItemAlignment.Left
Lab.Name =
"Lab01"
Lab.Alignment = ToolStripItemAlignment.Left
tscbo.Alignment = ToolStripItemAlignment.Left

With
tscbo.ComboBox
.Name =
"pmtsComboBox1"
.BackColor = Color.Green
.ForeColor = Color.White
.BindingContext = Me.BindingContext
ValueMember =
"Value"
.DisplayMember = "Display"
.DataSource = tboxcbo1
End With

tsItem.Items.Add(sep)
tsItem.Items.Add(Lab)
tsItem.Items.Add(tscbo)
AddHandler tscbo.ComboBox.SelectedIndexChanged, AddressOf pmtsComboBox1SIC

End If

The handler detects the selectedindexchange, but I do'nt know how to access the selectedindex of
the toolstripcombobox created

Can anyone help





Sub AddReportViewerButton()
Answers (1)