How To Make a ScreenShot Emailer

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
2 posts Page 1 of 1
Contributors
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

How To Make a ScreenShot Emailer
Bogoh67
let me know guys if someone already made this

first make your form with two buttons(i made mine with pictureboxes so change all of them to button or button)
then make another button and make the text
Code: Select all
Mail Settings
then make a picturebox and name it picturebox3 make a new form and call it Form2.vb make 5 textboxes and name them
Code: Select all
From
Code: Select all
Password
Code: Select all
Who_To
Code: Select all
subject
Code: Select all
body
then
make one checkbox the text for checkbox is
Code: Select all
Password Text Safe On/Off
and lastly add one button saying ok go back to form1 and put this code
Code: Select all
Imports System.Net.Mail
Public Class Form1
    Dim from As String = My.Settings.from
    Dim pass As String = My.Settings.pass
    Dim whoto As String = My.Settings.whoto
    Dim subject As String = My.Settings.subject
    Dim body As String = My.Settings.body

     Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Me.Visible = False
        Dim Bounds As Rectangle
        Dim ScreenShot As System.Drawing.Bitmap
        Dim Gfx As Graphics
        Bounds = Screen.PrimaryScreen.Bounds
        ScreenShot = New System.Drawing.Bitmap(Bounds.Width, Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        Gfx = Graphics.FromImage(ScreenShot)
        Gfx.CopyFromScreen(Bounds.X, Bounds.Y, 0, 0, Bounds.Size, CopyPixelOperation.SourceCopy)
        PictureBox3.Image = ScreenShot
        Me.Visible = True
        PictureBox3.Image.Save("your file name.jpg")
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Dim MyMailMessage As New MailMessage
        MyMailMessage.From() = New MailAddress(from)
        MyMailMessage.To.Add(whoto)
        MyMailMessage.Subject = (subject)
        MyMailMessage.Body = (body)
        MyMailMessage.Attachments.Add(New System.Net.Mail.Attachment("your file name.jpg"))
        Dim SMTP As New SmtpClient("smtp.gmail.com")
        SMTP.Port = 587
        SMTP.EnableSsl = True
        SMTP.Credentials = New System.Net.NetworkCredential(from, pass)
        SMTP.Send(MyMailMessage)
        MsgBox("may take a while", MsgBoxStyle.OkOnly, "sending...")
    End Sub

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MailBtn.Click
        Form2.Show()
    End Sub
End Class
notify me for any errors

then form2 code
Code: Select all
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Office2007ColorTable = DevComponents.DotNetBar.Rendering.eOffice2007ColorScheme.VistaGlass
        From.Text = My.Settings.from
        Password.Text = My.Settings.pass
        Who_To.Text = My.Settings.whoto
        subject.Text = My.Settings.subject
        body.Text = My.Settings.body
    End Sub

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        My.Settings.from = From.Text
        My.Settings.pass = Password.Text
        My.Settings.whoto = Who_To.Text
        My.Settings.subject = subject.Text
        My.Settings.body = body.Text
        My.Settings.Save()
        Me.Close()
    End Sub

    Private Sub CheckBoxX1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            Password.UseSystemPasswordChar = True
            Me.Invalidate()
        ElseIf CheckBox1.Checked = False Then
            Password.UseSystemPasswordChar = False
            Me.Invalidate()
        End If
    End Sub
End Class



then make settings named

Code: Select all
from
Code: Select all
pass
Code: Select all
whoto
Code: Select all
subject
Code: Select all
body
and it should be done here is my image


Image
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

i dont think anyone has made this yet good job its good for a error reporting system
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
2 posts Page 1 of 1
Return to “Tutorials”