Combobox - Name / Value without DataBind

  • Thread starter Thread starter Brian K. Williams
  • Start date Start date
B

Brian K. Williams

Does anyone know how to add the name/value to a Combobox without using the
DataBind?
With ASP.Net I can accomplish this like:
ComboBox.Items.Insert(0, new ListItem(string text,string value));



Thanks in advance..
Brian K. Williams
 
* "Brian K. Williams said:
Does anyone know how to add the name/value to a Combobox without using the
DataBind?
With ASP.Net I can accomplish this like:
ComboBox.Items.Insert(0, new ListItem(string text,string value));

\\\
Public Class ListItem
Private m_Value As String
Private m_Text As String

Public Property Value() As String
Get
Return m_Value
End Get
Set(ByVal Value As String)
m_Value = Value
End Set
End Property

Public Property Text() As String
Get
Return m_Text
End Get
Set(ByVal Value As String)
m_Text = Value
End Set
End Property

Public Overrides Function ToString() As String
Return m_Text
End Function
End Class
///
 
See below...
\\\
Public Class ListItem
Private m_Value As String
Private m_Text As String

Public Property Value() As String
Get
Return m_Value
End Get
Set(ByVal Value As String)
m_Value = Value
End Set
End Property

Public Property Text() As String
Get
Return m_Text
End Get
Set(ByVal Value As String)
m_Text = Value
End Set
End Property

Public Overrides Function ToString() As String
Return m_Text
End Function
End Class
///

I've seen the following also. Which is correct?

public class CValue : object
{
private string m_Display;
private long m_Value;
public CValue(string Display, long Value)
{
m_Display = Display;
m_Value = Value;
}
public override string ToString()
{
return m_Display;
}
public long ItemData
{
get{return m_Value;}
set{ m_Value = value; }
}
}
 
Herfried K. Wagner [MVP] wrote:

ps - I realize one is VB and the other is C# but the method names are
the issue...

/steveA
 
Back
Top