Sub MyCreateButton(condition As String) As Button
Select condition
Case "1"
Dim btn As Button
btn.Initialize("btn")
btn.Text = "Some text 1"
btn.Color = Colors.Red
return btn
Case "2"
Dim btn As Button
btn.Initialize("btn")
btn.Text = "Some text 2"
btn.Color = Colors.Yellow
return btn
Case Else
'Other value is not expected, so we return a NULL
return null
End Select
End Sub