Results 1 to 3 of 3

Thread: What is wrong about these codes

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    London United Kingdom
    Posts
    334

    Post What is wrong about these codes

    Hi, I have openfiledialog, and I use this code to open the file on pc but I get error that (formfile is not a member of system.drawing.image) below is the code.
    Code:
      Private Sub btnBrowse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
        
            With OpenFileDialog1
                .InitialDirectory = "\My Document\My Pictures"
                .Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg"
                .FilterIndex = 2
            End With
    
            If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
                With Picture1
                    .Image = Image.Fromfile(OpenFileDialog1.FileName)
                    .SizeMode = PictureBoxSizeMode.CenterImage
                End With
                Me.txtFileName.Text = OpenFileDialog1.FileName
            End If
        End Sub
    Also I get error message about the code below as well that (fromstream is not a member of system.drawing.image)
    Code:
     Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
            Dim arrPicture() As Byte = _
             CType(dsPictures.Tables(0).Rows(lstPictures.SelectedIndex)("Picture"), _
             Byte())
            Dim ms As New MemoryStream(arrPicture)
    
            With Picture2
                .Image = Image.fromStream(ms)
                .SizeMode = PictureBoxSizeMode.StretchImage
            End With
    
            txtFileName.Text = _
             dsPictures.Tables(0).Rows(lstPictures.SelectedIndex)("PictureName").ToString
    
            ms.Close()
    
        End Sub
    Could anyone help.

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is wrong about these codes

    Hey,

    The Framework that is used on a Windows Mobile Device does not support every method that is in the full blown Framework, so it is possible that these two methods are not there.

    I have just tried to do the same thing as you, and I get the same error.

    Gary

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: What is wrong about these codes

    Ya, FromFile is not supported in the CF.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width