473,804 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error when 'option strict'

Private Sub FlowLayoutPanel 1_DragDrop(ByVa l sender As System.Object,
ByVal e As System.Windows. Forms.DragEvent Args) Handles
FlowLayoutPanel 1.DragDrop
If e.Data.GetDataP resent(DataForm ats.FileDrop) Then
Dim fullFilenames() As String
fullFilenames = e.Data.GetData( DataFormats.Fil eDrop)
End If
End Sub

Line 'fullFilenames = e.Data.GetData( DataFormats.Fil eDrop)' 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
2 1295
GetData returns an Object. If it's really a string array, then you
need to cast it by calling DirectCast:

fullFilenames =
DirectCast(e.Da ta.GetData(Data Formats.FileDro p),String())

Feb 7 '06 #2
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************* *********@g47g2 00...legr oups.com...
GetData returns an Object. If it's really a string array, then you
need to cast it by calling DirectCast:

fullFilenames =
DirectCast(e.Da ta.GetData(Data Formats.FileDro p),String())

Feb 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2325
by: eje | last post by:
IsNumeric(value) should return false if value "can not be successfully converted to a Double." Instead I get the following error message: "Input string was not in a correct format." I use the following function in a validating class to use when needed. (Value = H880118A gave the error (like other 'unconvertible' strings)) Public Function Numeric(ByVal value) As Boolean
5
5042
by: ddd | last post by:
Hi, I am having problems with using the DrawToDC of the MSHTML.iHTMLElementRender in a VB.net application. For some reason I am getting a "catastrophic error". I am basing the code on c# examples, and I am not sure what exactly I am doing wrong. From the C# posts it seems that the drawtodc has a bug and you need to redifine it, so i followed their advice and specified an interface as below:
3
2007
by: Starbuck | last post by:
Hi The following generates an error when Option Strict is On Can anytell tell me how to get round this please. Private Sub optWithTone_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles optWithTone.CheckedChanged If eventSender.Checked Then pAlarmOption = NokiaCLCalendar.CalendarAlarmType.CALENDAR_ALARM_WITH_TONE
4
13780
by: dc15 | last post by:
For an intro to VB project I have to write a program which takes an amount of Miles, Yards, and Inches.....and converts it to metric (KM, M, and CM) when all values are entered to the input text boxes it works fine, but if there is a number missing I get the following error: An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll Additional information: Cast from string "" to type 'Double' is...
7
1886
by: Charlie Brookhart | last post by:
I have a program (posted below) that is supposed to take liters, which is the user input, and convert it to pints and gallons. The pints and gallons are displayed in a read only textbox. I don't understand how to fix the problem. 'declaring variables Dim totalLiters As Double = Convert.ToDouble(txtLiters.Text) Dim totalPints As Double = Convert.ToDouble(txtPints.Text)
2
1330
by: Justin | last post by:
I have set Option Strict On I also have Enum AssemblyLineStatus As Integer My question is how come there is no compilation error when I compile following code? If CInt(ddlStatus.SelectedItem.Value) = AssemblyLineStatus.Client Then ' do whatever End If Shouldn't this cause a compilation error? I know in C#, you have to
4
3788
by: Neo | last post by:
I found on error resume next doesn't work in for each... e.g. on error resume next for each x in y 'do stuff next if you have an error in for each loop, it falls in infinite loop... it doesn't move to next element... this sad thing but, it's indication that we must move to try catch instead of on error.
4
1642
by: =?Utf-8?B?UGl0Rw==?= | last post by:
Here the facts as code sample: Public Class Class1 Sub ABC(ByVal item As IUnit) End Sub End Class Public Interface IUnit ' or any other Interface ReadOnly Property Heureka() As Activator ReadOnly Property Reference() As String
2
1848
by: Francine | last post by:
Below is the code - I did not write this. This is a legacy program written in Perl, Html and java. I'm supposed to convert to dot net. This is the original code I was given. When I click on the create button after entering a new Workplan name, I get the jScript error: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.