G
Guest
The following code works when Option Strict is off:
Dim thumbSize As New Size
thumbSize = CType(NewthumbSize(g.Width, g.Height, 100), System.Drawing.Size)
Dim imgThumbOutput As New Bitmap(g, thumbSize.Width, thumbSize.Height)
imgThumbOutput.Save(Server.MapPath(ThumbnailPath), thisFormat)
When I turn on Option Strict, I receive the following compile error:
Overload resolution failed because no accessible 'Save' can be called with
these arguments:
'Public Sub Save(stream As System.IO.Stream, format As
System.Drawing.Imaging.ImageFormat)': Value of type 'String' cannot be
converted to 'System.IO.Stream'.
'Public Sub Save(stream As System.IO.Stream, format As
System.Drawing.Imaging.ImageFormat)': Option Strict On disallows implicit
conversions from 'System.Object' to 'System.Drawing.Imaging.ImageFormat'.
'Public Sub Save(filename As String, format As
System.Drawing.Imaging.ImageFormat)': Option Strict On disallows implicit
conversions from 'System.Object' to 'System.Drawing.Imaging.ImageFormat'.
Tried converting the path:
imgThumbOutput.Save(CType(Server.MapPath(ThumbnailPath), System.IO.Stream),
thisFormat)
but it errored because you can't convert a string into a System.IO.Stream.
Is there a way of rewriting this line to work with Option Strict? Thanks.
Dim thumbSize As New Size
thumbSize = CType(NewthumbSize(g.Width, g.Height, 100), System.Drawing.Size)
Dim imgThumbOutput As New Bitmap(g, thumbSize.Width, thumbSize.Height)
imgThumbOutput.Save(Server.MapPath(ThumbnailPath), thisFormat)
When I turn on Option Strict, I receive the following compile error:
Overload resolution failed because no accessible 'Save' can be called with
these arguments:
'Public Sub Save(stream As System.IO.Stream, format As
System.Drawing.Imaging.ImageFormat)': Value of type 'String' cannot be
converted to 'System.IO.Stream'.
'Public Sub Save(stream As System.IO.Stream, format As
System.Drawing.Imaging.ImageFormat)': Option Strict On disallows implicit
conversions from 'System.Object' to 'System.Drawing.Imaging.ImageFormat'.
'Public Sub Save(filename As String, format As
System.Drawing.Imaging.ImageFormat)': Option Strict On disallows implicit
conversions from 'System.Object' to 'System.Drawing.Imaging.ImageFormat'.
Tried converting the path:
imgThumbOutput.Save(CType(Server.MapPath(ThumbnailPath), System.IO.Stream),
thisFormat)
but it errored because you can't convert a string into a System.IO.Stream.
Is there a way of rewriting this line to work with Option Strict? Thanks.