Hi all,
I got a problem with part of my application, it's an exception I've never seen before.
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:
'Public Sub New(original As System.Drawing.Image)': Argument matching parameter 'original' narrows from 'Object' to 'System.Drawing.Image'.
'Public Sub New(stream As System.IO.Stream)': Argument matching parameter 'stream' narrows from 'Object' to 'System.IO.Stream'.
'Public Sub New(filename As String)': Argument matching parameter 'filename' narrows from 'Object' to 'String'. C:\Documents and Settings\user\Desktop\thornhill2011\malachy\WindowsApplication1\WindowsApplication1\Home.vb 201 23 WindowsApplication1
Private Sub DisplayImage()
Dim ds As New DataSet
Dim inc As Integer = 0
Dim MaxRows As Integer
Dim da As New OleDb.OleDbDataAdapter
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim sql As String
Dim Itag_Found As Boolean = False
Dim Ifound_ID As Integer = 0
dbProvider = "Provider = Microsoft.ACE.OLEDB.12.0;"
dbSource = "Data Source = C:\Documents and Settings\user\Desktop\thornhill2011\malachy\WindowsApplication1\WindowsApplication1\Patient Database.mdb;Persist Security Info = True;"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM ImageTable"
da = New OleDb.OleDbDataAdapter(Sql, con)
da.Fill(ds, "Patient Database")
MaxRows = ds.Tables("Patient Database").Rows.Count
Try
For inc = 0 To (MaxRows - 1)
If UID = ds.Tables("Patient Database").Rows(inc).Item("ID") Then
Itag_Found = True
Ifound_ID = inc
Else
Itag_Found = False
End If
Next
If Itag_Found = True Then
Dim i As Array
'Using Bmp As New Bitmap("C:\Documents and Settings\user\Desktop\thornhill2011\malachy\WindowsApplication1\WindowsApplication1\My Images\Flowers.jpg")
Using Bmp As New Bitmap(ds.Tables("Patient Database").Rows(inc).Item("ID"))
Using MS As New MemoryStream
Bmp.Save(MS, ImageFormat.Jpeg)
i = MS.ToArray
End Using
End Using
Dim ImgStream As MemoryStream = New MemoryStream(CType(i, Byte()))
Home_PictureBox.Image = New Bitmap(ImgStream)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning)
Finally
Windows.Forms.Cursor.Current = Cursors.Default
End Try
End Sub
The commented out line works just fine, it searches a system folder with no problems, but the line under it is ment to search a database for an image. I've tried to set the option "strict" to off but it makes no difference, anyone with any advice would be great as I'm truly stumped with this one!!