yalamanchir
asked on
listbox
i have a list box on my page. I bind this listbox to a field in my database.
but i want the values in this listbox to appear seperated by commas instead of one by one..
is that possible in vb.net ..
if somebosy cud help me out with this it wud be a great help
thanks
but i want the values in this listbox to appear seperated by commas instead of one by one..
is that possible in vb.net ..
if somebosy cud help me out with this it wud be a great help
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
check this out....i experimented with the listbox and it looks like it works - paste this in a project
(im sure you can just manually add the commas)
Public Class Form2
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents ListBox1 As System.Windows.Forms.ListB ox
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.ListBox1 = New System.Windows.Forms.ListB ox
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.HorizontalScro llbar = True
Me.ListBox1.Items.AddRange (New Object() {"one", "two", "three", "four", "five", "six"})
Me.ListBox1.Location = New System.Drawing.Point(72, 17)
Me.ListBox1.MultiColumn = True
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.ScrollAlwaysVi sible = True
Me.ListBox1.Size = New System.Drawing.Size(552, 43)
Me.ListBox1.TabIndex = 5
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(696, 77)
Me.Controls.Add(Me.ListBox 1)
Me.Name = "Form2"
Me.Text = "Form2"
Me.ResumeLayout(False)
End Sub
#End Region
End Class
(im sure you can just manually add the commas)
Public Class Form2
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents ListBox1 As System.Windows.Forms.ListB
<System.Diagnostics.Debugg
Me.ListBox1 = New System.Windows.Forms.ListB
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.HorizontalScro
Me.ListBox1.Items.AddRange
Me.ListBox1.Location = New System.Drawing.Point(72, 17)
Me.ListBox1.MultiColumn = True
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.ScrollAlwaysVi
Me.ListBox1.Size = New System.Drawing.Size(552, 43)
Me.ListBox1.TabIndex = 5
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(696, 77)
Me.Controls.Add(Me.ListBox
Me.Name = "Form2"
Me.Text = "Form2"
Me.ResumeLayout(False)
End Sub
#End Region
End Class
ASKER