가 나는 System.Windows.Forms.ListBox 그렇게 행동하는 것이 가능하다고 생각하지만, 그것이 작동되도록하려면 몇 가지 사소하지 않은 코드를 취할 것입니다. System.Windows.Forms.ListView에는이 동작이 내장되어 있으므로 ListBox 대신 ListView를 사용하는 것이 좋습니다.
' Hide the headers to make the ListView look like a ListBox.
Me.ListView1.View = View.Details
Me.ListView1.HeaderStyle = ColumnHeaderStyle.None
Me.ListView1.BeginUpdate()
Try
' System.Windows.Forms.ListView doesn't have data binding capability.
' The listview's items have to be added using its
' Items.Add, Items.AddRange or Items.Insert methods.
For Each filename As String In Directory.GetFiles("C:\Windows").Select(Function(s) Path.GetFileName(s))
Me.ListView1.Items.Add(filename)
Next
Finally
Me.ListView1.EndUpdate()
End Try
' Add the column after adding the items.
' Setting column width to -1 will make
' the column autosize itself to the longest item.
Dim columnHeader As New ColumnHeader
columnHeader.Width = -1
Me.ListView1.Columns.Add(columnHeader)
어떻게 사람 담당자를 제공합니까? 코드가 매력처럼 작동했기 때문에! 고마워요. 지금까지 영원히 있었어요. : D –
@ 매트 : 여기 담당자에 대한 자주 묻는 질문 항목의 (http://stackoverflow.com/faq#reputation). 당신이 대답을 수락 할 때 당신은 나에게 점수를주었습니다. 고맙습니다! –