title: generic error occurred in gdi+ vb.net
body: <p>hope fully its not repeated question coz i do too much search not find any answer.
  my code for saving image to database is</p>
  
  <pre><code>Private Function ConvertImageToRGBFormat(ByVal imgName As String) As Image
      Dim img As Image
      img = New Bitmap(imgName)
      If Not img.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppRgb Then
          Dim temp As Bitmap = New Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
          Dim g As Graphics = Graphics.FromImage(temp)
          g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel)
          g.Dispose()
          Return temp
      End If
      Return img
  End Function
  Private Sub btnTravel_Info_Room_Image_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTravel_Info_Room_Image.Click
      Dim dlg As New OpenFileDialog
      If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
          Dim bt As Byte()
          Dim myImage As Image
          myImage = ConvertImageToRGBFormat(dlg.FileName)
          Using stream = New MemoryStream()
              myImage.Save(stream, Drawing.Imaging.ImageFormat.Png)
              bt = stream.ToArray()
              myImage = New Bitmap(Image.FromStream(stream, True))
          End Using
          picTravel_Info_Hotel.Tag = bt
          picTravel_Info_Hotel.BackgroundImage = myImage
      End If
  End Sub
  </code></pre>
  
  <p>and code for getting image from database to picturebox is, and here i am getting error</p>
  
  <pre><code>Dim BArray As Byte() = CType(dt.Rows(0)("Room_Image"), Byte())
  Using MS As New System.IO.MemoryStream(BArray)
      picTravel_Info_Hotel.Tag = BArray
      MS.Position = 0
      picTravel_Info_Hotel.BackgroundImage = New Bitmap(Image.FromStream(MS, True))
      MS.Dispose()
  End Using
  </code></pre>
  
  <p>and i am getting "<strong>generic error occurred in gdi+</strong>" error on some of our pc's not on every one when i am getting image from database.
  thanks in advance :)  </p>