Results 1 to 3 of 3

Thread: Help me to convert in to byte.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Location
    Srilanka
    Posts
    8

    Smile Help me to convert in to byte.....

    hi friends. i'm currently doing an assignment which is based on vb.net and sql server. here i wanna capture an image and i wanna save that into a sql table named 'customer'. i have downloaded the code for capture the image from the webcam and store into local hard drive. (http://www.vb-helper.com/HowTo/howto...eo_capture.zip)

    When i click the save button in that app, its showing to save the captured image in a place by giving a name.

    '-----------------------------------------------------------------
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
    Dim data As IDataObject
    Dim bmap As Image

    data = Clipboard.GetDataObject()
    If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
    bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
    picCapture.Image = bmap

    ClosePreviewWindow()
    btnSave.Enabled = False
    btnStop.Enabled = False
    btnStart.Enabled = True

    If sfdImage.ShowDialog = DialogResult.OK Then
    bmap.Save(sfdImage.FileName, Imaging.ImageFormat.Bmp)
    End If

    End If
    End Sub
    '--------------------------------------------------------------------

    in the above code in red colored area, u can see variable bmap is holding captured image and i wanna pass that 'bmap' to sql table.

    pls help me...........thanks in advance

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Help me to convert in to byte.....

    First up, your clipboard code is way more complex than is necessary:
    vb.net Code:
    1. If Clipboard.ContainsImage() Then
    2.     Dim img As Image = Clipboard.GetImage()
    3.  
    4.     '...
    5. End If
    As for saving the Image to SQL Server, I have posted a thread in the VB.NET CodeBank submission that shows how to do just that. Follow the CodeBank link in my signature to find that thread.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Location
    Srilanka
    Posts
    8

    Smile Re: Help me to convert in to byte.....

    Quote Originally Posted by jmcilhinney View Post
    First up, your clipboard code is way more complex than is necessary:
    vb.net Code:
    1. If Clipboard.ContainsImage() Then
    2.     Dim img As Image = Clipboard.GetImage()
    3.  
    4.     '...
    5. End If
    As for saving the Image to SQL Server, I have posted a thread in the VB.NET CodeBank submission that shows how to do just that. Follow the CodeBank link in my signature to find that thread.
    thanks alot for info. i got the idea and working well. thank you so much

Tags for this Thread

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