nate Posted January 27, 2011 Posted January 27, 2011 I have this in a separate class file: Imports Microsoft.VisualBasic Public Class cboAddItem Public Value As String Public Item As String Public Sub New(ByVal NewItem As String, ByVal NewValue As String) Value = NewValue Item = NewItem End Sub Public Overrides Function ToString() As String Return Item End Function End Class I then use this in my page code: cboBusinessCategory.Items.Add(New cboAddItem("Show All", "1")) What am I missing or doing wrong? I get the intellisense error overload, add cannot be called with these arguments. cboAddItem can not be converted to string/listitem. Thanks in advance. Quote Ignorance begins with I.
Administrators PlausiblyDamp Posted January 28, 2011 Administrators Posted January 28, 2011 As the intellisense is indicating, you can only add a string or a ListItem to the DropDownList.Items collection. You should however be able to store the cboAddItem objects in a collection (such as a List(Of cboAddItem) and data bind to this collection. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.