Closed Thread
Results 1 to 10 of 10

Thread: Visual Basic Help!

  1. #1
    Dan's Avatar
    Dan
    Dan is offline
    Lord Of The Keys Dan is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    UK
    Posts
    1,258

    Visual Basic Help!

    Hi Everyone,
    Recently I have started with Visual Basic, but I've now got a little stuck...
    I need a script to save the contents of a form as a JPG file.
    If anyone can do this for me or tell me how to do it easily, they will recieve around 250 credits from me.

    Thanks!!! :thefinger
    Dan
    Thanks,
    Dan
    _______________
    Retired Staff

  2. #2
    andypalmer86 is offline x10Hosting Member andypalmer86 is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    4

    Re: Visual Basic Help!

    a post in this thread does what you're looking for I think

  3. #3
    Dan's Avatar
    Dan
    Dan is offline
    Lord Of The Keys Dan is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    UK
    Posts
    1,258

    Re: Visual Basic Help!

    Quote Originally Posted by andypalmer86 View Post
    a post in this thread does what you're looking for I think
    That doesn't work for me I'm afraid
    I think that person was probably using an older version of VB. I'm running the new 2008 one...

    Anyone else help me?
    Thanks,
    Dan
    _______________
    Retired Staff

  4. #4
    ezdookie is offline x10Hosting Member ezdookie is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    17

    Re: Visual Basic Help!

    Eh... Hi.. I don't have Visual Studio 2008 but if you are in problems you can add me to msn ezdookie@gmail.com for connect to your computer via VNC and make your job there...

    Did you understand my english??.. uh..

    P.D. That job was programmed with Visual Basic 6.0
    Last edited by ezdookie; 09-21-2008 at 11:07 AM.

  5. #5
    Dan's Avatar
    Dan
    Dan is offline
    Lord Of The Keys Dan is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    UK
    Posts
    1,258

    Re: Visual Basic Help!

    Quote Originally Posted by ezdookie View Post
    Eh... Hi.. I don't have Visual Studio 2008 but if you are in problems you can add me to msn ezdookie@gmail.com for connect to your computer via VNC and make your job there...

    Did you understand my english??.. uh..

    P.D. That job was programmed with Visual Basic 6.0
    I'm not sure I get what you mean...
    I would just like a script please that will let me do this.
    Anyone?
    Thanks,
    Dan
    _______________
    Retired Staff

  6. #6
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: Visual Basic Help!

    I don't have much experience in VB.Net but I think this thread might be of value:

    http://forums.ni.com/ni/board/messag...essage.id=1097

  7. #7
    supajason's Avatar
    supajason is offline x10 Lieutenant supajason is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    England........:-)
    Posts
    288

    Re: Visual Basic Help!

    Quote Originally Posted by http://www.developerfusion.co.uk/forums/p/26911/109890/
    You can take and save a picture of your form like this:

    Code:
    Option Explicit
    
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
    ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    
    Private Const KEYEVENTF_KEYUP = &H2
    
    Private Function SaveFormPic() As Picture
       Dim pic As StdPicture
       Set pic = Clipboard.GetData(vbCFBitmap)
       keybd_event vbKeyMenu, 0, 0, 0
       keybd_event vbKeySnapshot, 0, 0, 0
       DoEvents
       keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
       keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
       DoEvents
       Set SaveFormPic = Clipboard.GetData(vbCFBitmap)
       Clipboard.SetData pic, vbCFBitmap
    End Function
    
    Private Sub Command1_Click()
       SavePicture Clipboard.GetData(vbCFBitmap), "C:\MyPic.jpg" 'picture location
    End Sub
    The example requires one command button. It will take a picture of your form and save it into file "c:\mypic.jpg". You can change that.

    Good luck.
    From : http://www.developerfusion.co.uk/forums/p/26911/109890/
    supajason was here

  8. #8
    Dan's Avatar
    Dan
    Dan is offline
    Lord Of The Keys Dan is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    UK
    Posts
    1,258

    Re: Visual Basic Help!

    Quote Originally Posted by supajason View Post
    That doesn't work either I'm afraid...
    I hope I can get something that works soon.
    Thanks,
    Dan
    _______________
    Retired Staff

  9. #9
    Micro is offline Retired staff (11-12-2008) Micro is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    West Midlands
    Posts
    1,301

    Re: Visual Basic Help!

    Quote Originally Posted by Dan View Post
    That doesn't work either I'm afraid...
    I hope I can get something that works soon.
    Try this:

    Put this at the top of the class file (form file, whatever)

    Code:
    Imports System.Drawing
    Imports System.Drawing.Imaging
    And this where you want to save it
    Code:
    Dim img as Bitmap = new Bitmap( Me.Width, Me.Height )
    Dim g as Graphics = Graphics.FromImage( img )
     g.CopyFromScreen( new Point( Me.Left, Me.Top ), new Point( 0, 0 ), new Size( Me.Width, Me.Height ) )
    img.Save( "filename.jpg", ImageFormat.Jpeg )
    Micro

  10. #10
    Dan's Avatar
    Dan
    Dan is offline
    Lord Of The Keys Dan is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    UK
    Posts
    1,258

    Re: Visual Basic Help!

    Quote Originally Posted by Micro View Post
    Try this:

    Put this at the top of the class file (form file, whatever)

    Code:
    Imports System.Drawing
    Imports System.Drawing.Imaging
    And this where you want to save it
    Code:
    Dim img as Bitmap = new Bitmap( Me.Width, Me.Height )
    Dim g as Graphics = Graphics.FromImage( img )
     g.CopyFromScreen( new Point( Me.Left, Me.Top ), new Point( 0, 0 ), new Size( Me.Width, Me.Height ) )
    img.Save( "filename.jpg", ImageFormat.Jpeg )
    That works just great micro!!!
    Thanks! Sending you 250 credits now for helping me.
    Thanks,
    Dan
    _______________
    Retired Staff

Closed Thread

Similar Threads

  1. A simple Visual Basic Login Form
    By Zenax in forum Tutorials
    Replies: 0
    Last Post: 03-13-2007, 08:59 AM
  2. Visual Basic + Microsoft Access
    By Zenax in forum Off Topic
    Replies: 2
    Last Post: 03-01-2007, 03:12 AM
  3. Using Visual Basic 2005
    By TheJeffsta in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 08-05-2006, 02:18 PM
  4. Visual Basic for Free?
    By AsPeRiTy in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 08-15-2005, 08:24 PM
  5. Visual Basic: An introduction Part 1
    By thegoodlist in forum Tutorials
    Replies: 0
    Last Post: 06-08-2005, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers