VB6 转换为 VB.net 变体问题

发布于 2024-08-13 21:10:13 字数 498 浏览 3 评论 0原文

我的任务是将 VB6 程序转换为 VB.NET。在我的在线研究中,每个人似乎都说我需要检查我的代码并摆脱我拥有的任何变体。到目前为止,我的运气很好,但在更换这个时遇到了问题。

Private Sub lvThumbView_OLEDragDrop(Data As MSComctlLib.DataObject)
    Dim File As Variant

    For Each File In Data.Files
        Select Case UCase(right(File, 3))
            Case "JPG", "BMP"
            ..... 
        End Select
    Next File
End Sub

我对 VB(无论是 6 还是 .net)还是很陌生,而且我很难找到替代方案。 VB.net 中的转换工具可以很好地处理这个问题吗?或者我需要改变这个吗?如果我这样做,有更好的选择吗?原谅我的菜鸟。

先感谢您。

I have been tasked to convert out VB6 program to VB.NET. In my research online everyone seems to say I need to go through my code and get rid of any Variants I have. I have had pretty good luck so far, but I am having an issue in replacing this one.

Private Sub lvThumbView_OLEDragDrop(Data As MSComctlLib.DataObject)
    Dim File As Variant

    For Each File In Data.Files
        Select Case UCase(right(File, 3))
            Case "JPG", "BMP"
            ..... 
        End Select
    Next File
End Sub

I am still pretty new to VB (either 6 or .net) and I am having a hard time finding an alternative for this. Will the convert tool in VB.net handle this just fine? Or do I need to change this? If I do, is there a better alternative for this? Forgive my noobness.

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初吻给了烟 2024-08-20 21:10:13

查看代码,您可能会将 VB6 Listview 控件替换为 .NET ListView 控件。您列出的 Sub 看起来像是处理 ListView 控件的 DragDrop 事件(我对该控件不熟悉,但这就是它的用途,从名称来看) 。

看一下 DragDrop 事件和 ListView 控件的DoDragDrop() 方法,了解如何使用字符串集合作为与事件关联的数据。

Looking at the code, it's likely that you'll be replacing the VB6 Listview control with the .NET ListView control. The Sub that you've listed looks like it handles the DragDrop event of the ListView control (I'm not familiar with the control, but this is what it appears to be for, going by the name).

Take a look at the DragDrop event and the DoDragDrop() method of the ListView control, to see how you can use a collection of strings as the data associated with the event.

墨落画卷 2024-08-20 21:10:13

提前进行所有可能的更改会很有帮助,但如果出现问题,您可能会节省一些时间等待转换后。

之后您将需要进行一些更改,但您可以继续进行 .net 转换,然后清理留下的内容。

例如,您可能在 .net 转换之前将此处的变体转换为字符串,却发现 .net 列表视图 DragEventArgs.data 有所不同。 (我不确定它是什么,但转换后会更容易找到。)

It will be helpful to make all the changes you can beforehand, but if there is a question, you might save some time to waiting until after the conversion.

You will have a few changes to make afterward, but you can go ahead and make the .net conversion,then clean up what is left behind.

For example, you might convert the variant here to a string before the .net conversion, only to find out the the .net listview DragEventArgs.data is something different. (I'm not sure what it is, but it would be easier to find out after you did the conversion.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文