开发者

VB6 convert to VB.net Variant question

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.


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.


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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜