Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 从Microsoft.VisualBasic.Compatibility替换DirListBox和/或FileListBox_.net_.net 4.5_Vb6 Migration - Fatal编程技术网

.net 从Microsoft.VisualBasic.Compatibility替换DirListBox和/或FileListBox

.net 从Microsoft.VisualBasic.Compatibility替换DirListBox和/或FileListBox,.net,.net-4.5,vb6-migration,.net,.net 4.5,Vb6 Migration,我有一个已迁移到VB.net的VB6应用程序,我正在尝试将框架版本升级到4.5,这抱怨Microsoft.VisualBasic.Compatibility dll中的所有内容都过时了。除了FileListBox和DirListBox之外,我可以很容易地替换所有东西——这很乏味,但我不必创建任何新控件 这些控制装置是否有替代品?有人知道它们是否已与框架的其余部分一起开源吗?您可以使用简单的ListBox控件,并使用My.Computer.FileSystem将它们设置为旧的DriveListBo

我有一个已迁移到VB.net的VB6应用程序,我正在尝试将框架版本升级到4.5,这抱怨Microsoft.VisualBasic.Compatibility dll中的所有内容都过时了。除了FileListBox和DirListBox之外,我可以很容易地替换所有东西——这很乏味,但我不必创建任何新控件


这些控制装置是否有替代品?有人知道它们是否已与框架的其余部分一起开源吗?

您可以使用简单的ListBox控件,并使用My.Computer.FileSystem将它们设置为旧的DriveListBox、DirectoryListBox和FileListBox。您可以使用如下内容

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    lstDriveList.DataSource = My.Computer.FileSystem.Drives
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstDriveList.SelectedIndexChanged
    lstDirectoryList.DataSource = My.Computer.FileSystem.GetDirectories(lstDriveList.SelectedValue.ToString())
End Sub


Private Sub lstDirectoryList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstDirectoryList.SelectedIndexChanged
    lstFileList.DataSource = My.Computer.FileSystem.GetFiles(lstDirectoryList.SelectedValue.ToString())
End Sub

所有的lst都只是普通的列表框,您也可以使用ListView控件,类似的方式

不幸的是,你必须自己动手(就像@kman踢了你一样)

这里讨论了一些备选方案:


有人建议回到Framework3.5(如果您没有使用4.5功能),为编写新控件争取一些时间

只是提醒一下,这不会列出/输入子目录。