Hi,
I don't know what exception was fixed with (from 12.2.0.36 Release Notes):
#123949-In SplitButton control, DropDownItems property no longer throws an exception.
but unfortunately the code I use no longer works:
'btnSplitCreate.DropDownItems.Add("Create NEW BLANK diet record")
'btnSplitCreate.DropDownItems(0).Image = My.Resources.Resources.new_plus_green4
'btnSplitCreate.DropDownItems(0).ImageScaling = ToolStripItemImageScaling.None
'btnSplitCreate.DropDownItems(0).Margin = New System.Windows.Forms.Padding(0, 3, 0, 3)
'btnSplitCreate.DropDownItems.Add("Create NEW (repeat) diet record from currently displayed record")
'btnSplitCreate.DropDownItems(1).Image = My.Resources.Resources.Redo_icon
'btnSplitCreate.DropDownItems(1).ImageScaling = ToolStripItemImageScaling.None
'btnSplitCreate.DropDownItems(1).Margin = New System.Windows.Forms.Padding(0, 3, 0, 3)
'btnSplitCreate.DropDownItems.Add("DELETE this diet record")
'btnSplitCreate.DropDownItems(2).Image = My.Resources.Resources.delete_red
'btnSplitCreate.DropDownItems(2).ImageScaling = ToolStripItemImageScaling.None
'btnSplitCreate.DropDownItems(2).Margin = New System.Windows.Forms.Padding(0, 3, 0, 3)
I was able to work around some of this using:
Dim SplitButtonItems1 As SplitButtonItems = New SplitButtonItems()
SplitButtonItems1.ItemImage = AllergyUnitDB.My.Resources.Resources.new_plus_green4
SplitButtonItems1.ItemText = "Create NEW BLANK diet record"
SplitButtonItems1.Name = "SplitButtonItems1"
btnSplitCreate.DropDownItems.Add(SplitButtonItems1)
Dim SplitButtonItems2 As SplitButtonItems = New SplitButtonItems()
SplitButtonItems2.ItemImage = My.Resources.Resources.Redo_icon
SplitButtonItems2.ItemText = "Create NEW (repeat) diet record from currently displayed record"
SplitButtonItems2.Name = "SplitButtonItems2"
btnSplitCreate.DropDownItems.Add(SplitButtonItems2)
Dim SplitButtonItems3 As SplitButtonItems = New SplitButtonItems()
SplitButtonItems3.ItemImage = My.Resources.Resources.delete_red
SplitButtonItems3.ItemText = "DELETE this diet record"
SplitButtonItems3.Name = "SplitButtonItems3"
btnSplitCreate.DropDownItems.Add(SplitButtonItems3)
However the following code also doesn't work but doesn't have an obvious workaround:
If dt.Rows.Count = 0 Then
btnSplitCreate.Text = "Create NEW BLANK diet record"
btnSplitCreate.DropDownItems(1).Enabled = False
btnSplitCreate.DropDownItems(2).Enabled = False
Else
btnSplitCreate.Text = " Create NEW (repeat) diet from last"
btnSplitCreate.DropDownItems(1).Enabled = True
btnSplitCreate.DropDownItems(2).Enabled = True
End If
Is this the result of a bug or has all this functionality been removed permanently?
thanks,
Tim