Home All Groups Group Topic Archive Search About

Error when 'option strict'

Author
7 Feb 2006 1:57 PM
philip
Private Sub FlowLayoutPanel1_DragDrop(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.DragEventArgs) Handles
FlowLayoutPanel1.DragDrop
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            Dim fullFilenames() As String
            fullFilenames = e.Data.GetData(DataFormats.FileDrop)
        End If
    End Sub

Line 'fullFilenames = e.Data.GetData(DataFormats.FileDrop)' give the Error
'Option Strict On disallows implicit conversions from 'Object' to
'1-dimensional array of String'
I must disable 'Option strict' to continue...

What must I change to avoid this error ?

Thanks for your attention

Philip

Author
7 Feb 2006 2:08 PM
Chris Dunaway
GetData returns an Object.  If it's really a string array, then you
need to cast it by calling DirectCast:

fullFilenames =
DirectCast(e.Data.GetData(DataFormats.FileDrop),String())
Author
7 Feb 2006 5:27 PM
philip
Perfect !

Thanks sincerely. Option is again 'strict' without error. I'm happy !

"Chris Dunaway" <dunaw***@gmail.com> a écrit dans le message de news:
1139321282.365767.285***@g47g2000cwa.googlegroups.com...
Show quoteHide quote
> GetData returns an Object.  If it's really a string array, then you
> need to cast it by calling DirectCast:
>
> fullFilenames =
> DirectCast(e.Data.GetData(DataFormats.FileDrop),String())
>