gpt4 book ai didi

vb.net - ListView 中的详细信息属性不显示

转载 作者:行者123 更新时间:2023-12-03 01:48:49 25 4
gpt4 key购买 nike

我将 ListView 设置为详细信息以尝试创建列,但这些列不会显示。是什么阻止了列的显示?

Imports System.IO
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Menu


Public Class Jonathan_Roda_P4
Dim TitlesData(21)
Dim BOData(21)

'Clear Button Function
Private Sub ResetClearToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ResetClearToolStripMenuItem.Click
'Clear Title LV
DispResView.Clear()
'Clear Box Office List
BOList.Items.Clear()
'Resets User Message to default
UsrMsg.Text = "Data Not Loaded"
End Sub

'Help/Instructions Properties

Private Sub InstructionsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InstructionsToolStripMenuItem.Click
MessageBox.Show("1. Click the 'Load Files' Button" & vbNewLine _
& vbNewLine _
& "2. Select two respective files." & vbNewLine _
& " (Note: Each file must have the same number of lines)" & vbNewLine _
& " (Note: You may only select two files)" & vbNewLine _
& vbNewLine _
& "3. Select the 'Open' button to load your selected files" & vbNewLine _
& vbNewLine _
& "4. The Box Office Lister will now display each file's contents as it appears in the file" & vbNewLine _
& vbNewLine _
& "5. Clicking any of the sort buttons will reorder the displayed content as follows:" & vbNewLine _
& " a) Sort by A-Z: Sorts the displayed content alphabetically by title" & vbNewLine _
& " b) Sort by Z-A: Sorts the displayed content in reverse alphabetical order by title" & vbNewLine _
& " c) Sort by 0-9: Sorts the displayed content in ascending numerical order by Box Office Amount" & vbNewLine _
& " d) Sort by 9-0: Sorts the displayed content in descending numerical order by Box Office Amount" & vbNewLine _
& vbNewLine _
& "6. Clicking the 'Clear' button will reset the program and require you to select two new files" & vbNewLine _
& vbNewLine _
& "7. Clicking the 'Exit' button will close the program" & vbNewLine _
& vbNewLine _
& "8. TOP THIRD" & vbNewLine _
& " Top Third lists the top 1/3 missions in order of Box Office Amount", "007 Box Office Lister Instructions")
End Sub

'File/Exit Properties
Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub

'Exit Button Properties
Private Sub ExitBtn_Click(sender As Object, e As EventArgs) Handles ExitBtn.Click
Application.Exit()
End Sub

Private Sub ClearBtn_Click(sender As Object, e As EventArgs) Handles ClearBtn.Click
DispResView.Clear()
UsrMsg.Text = "Data Not Loaded"
End Sub

Private Sub LoadButton_Click(sender As Object, e As EventArgs) Handles LoadButton.Click

With OpenFileDialog1
.CheckPathExists = True
.DefaultExt = "txt"
.Filter = _
"Text files (*.txt)|*.txt"
.Multiselect = True
.RestoreDirectory = True
.Title = "Open"
.ValidateNames = True
DispResView.Clear()
End With
'Resets User Message to default if another message is displayed
UsrMsg.Text = "Data Not Loaded"

'Sets Default folder to Desktop
OpenFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

'OpenFileDialog Properties
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim count As Integer = 0
For Each s As String In OpenFileDialog1.FileNames
Dim sAllData() As String = System.IO.File.ReadAllLines(s)
count = count + 1
Next
For Each openFile As String In OpenFileDialog1.FileNames
Dim getAllData() As String = File.ReadAllLines(openFile)
For i As Integer = 0 To getAllData.Length - 1
DispResView.Items.Add(getAllData(i))
Next
Next
End If

End Sub

Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk

End Sub
End Class

最佳答案

您是否已将所有列标题添加到 ListView.Columns 中? ListView 不会显示比其标题更多的列。

DispResView.Columns.Add "Name"
DispResView.Columns.Add "Size"
'etc.

请注意,如果您希望不删除列标题,则应调用 DispResview.Items.Clear 而不是 DispResView.Clear

关于vb.net - ListView 中的详细信息属性不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15582300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com