By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,699 Members | 1,218 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,699 IT Pros & Developers. It's quick & easy.

Error when 'option strict'

P: n/a
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
Feb 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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),St ring())

Feb 7 '06 #2

P: n/a
Perfect !

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

"Chris Dunaway" <du******@gmail.com> a écrit dans le message de news:
11**********************@g47g2000cwa.googlegroups. com...
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),St ring())

Feb 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.