Results 1 to 8 of 8

Thread: Need some help with gathering form data via screenshot...

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    13

    Need some help with gathering form data via screenshot...

    Name:  mortgage-lead-to-app.JPG
Views: 57
Size:  229.7 KB

    I received some answers from the .net forum but I'm not sure if they are correct? Here was the original post... the form is above... Thanks for any help!

    ...."I'm a financial services rep with a minor in Computer Science so I got assigned the VB task of creating a new lead to app program to make our biz flow more efficient...

    Unfortunately, I haven't used my CS skills since college graduation in 2002 so it was a lot of "on the job learning" on my own...

    I came up with exactly what the boss wanted for the interface for the telemarketers... I can even have an email shot off to the underwriter upon the "submit button" command.

    What I am having trouble with is including all of the info entered into the fields in the email to the underwriter... I tried to do a screenshot to make it easier on myself but it hasn't worked...

    Any thoughts? Here is the interface and the code I employed to attach the screenshot to the emails but it doesn't seem to work . If a screenshot attachment is impossible in 6.5 I guess I can just attach field by field. "


    Private Sub Image1_Click()


    End Sub


    Private Sub CommandButton1_Click()



    ' Email Message Details
    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "Ryan VanSciver just converted a Lead to App!!!"
    objMessage.From = "pfsleadtoapp@gmail.com"
    objMessage.To = "pfsleadtoapp@gmail.com"
    objMessage.AddAttachment "C:\Documents and Settings\PUFF\Desktop\LeadApp.bmp"


    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2


    Set objConfig = CreateObject("cdo.configuration")
    Set Flds = objConfig.Fields

    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
    Flds.Item(schema & "smtpserverport") = 465
    Flds.Item(schema & "smtpauthenticate") = 1
    Flds.Item(schema & "sendusername") = "pfslead@ymail.com" 'username and password changed for security
    Flds.Item(schema & "sendpassword") = "hh"
    Flds.Item(schema & "smtpusessl") = 1
    Flds.Update
    Set objMessage.Configuration = objConfig


    objMessage.Send
    Set objMessage = Nothing

    End Sub

    Private Sub Label1_Click()

    End Sub

    Private Sub Label2_Click()

    End Sub

    Private Sub Label22_Click()

    End Sub

    Private Sub Label23_Click()

    End Sub

    Private Sub Label8_Click()

    End Sub

    Private Sub Label9_Click()

    End Sub

    Private Sub OptionButton1_Click()

    End Sub

    Private Sub ListBox1_Click()

    End Sub

    Private Sub OptionButton10_Click()

    End Sub

    Private Sub OptionButton11_Click()

    End Sub

    Private Sub OptionButton16_Click()

    End Sub

    Private Sub OptionButton18_Click()

    End Sub

    Private Sub OptionButton19_Click()

    End Sub

    Private Sub OptionButton24_Click()

    End Sub

    Private Sub OptionButton4_Click()

    End Sub

    Private Sub OptionButton7_Click()

    End Sub

    Private Sub OptionButton8_Click()

    End Sub

    Private Sub OptionButton9_Click()

    End Sub

    Private Sub RateBox_Change()

    End Sub



    Private Sub SingleFamilyHome_Click()

    End Sub

    Private Sub SOURCE_Click()

    End Sub

    Private Sub TextBox10_Change()

    End Sub

    Private Sub TextBox37_Change()

    End Sub

    Private Sub TITLE_Click()

    End Sub

    Private Sub UserForm_Click()

    End Sub


    that's it! I just need the numeric text boxes to be #s only and I need to figure out a way to attach a screenshot of the form... right now its just set up to email a dummy bitmap file...

    The other tweaks I wanted to include was to make sure that all fields were competed prior to the "submit" button working and having the currency and numeric boxes stuck as just that... rather than letting the text boxes be a free-for-all for whatever they feel like entering. I wanted to format the appropriate boxes for rates, numeric values, currency, etc but it's been 10 years and I can't remember???

    Any help would be greatly appreciated!!! Thanks!"...

  2. #2
    New Member
    Join Date
    Aug 12
    Posts
    13

    Re: Need some help with gathering form data via screenshot...

    So far... pietercdevries has helped me with this code... but I'm not sure if it will work because I was posting in the .net forum....

    Let me know what you guys think! Thanks... I need to have it done for work tomorrow AM EST!!! Thanks for all of your help!


    (From pietercdevries)

    Here is some code to Check if is numeric or is containig letter only and if is not empty and if checkbox or radio button has been used.

    If Not IsNumeric(textbox1.text) Then
    msgbox("Please Enter numbers only!", MsgBoxStyle.Information)
    Exit Sub
    End If

    If IsNumeric(textbox1.text) Then
    msgbox("Please Enter letters only!", MsgBoxStyle.Information)
    Exit Sub
    End If

    If textbox1.text = "" then
    msgbox("you can not leave this field blanc", MsgBoxStyle.Information)
    Exit Sub
    End if

    If CheckBox1.Checked = False And CheckBox2.Checked = False And CheckBox3.Checked = False And CheckBox4.Checked = False And CheckBox5.Checked = False Then
    MsgBox("Please select one", MsgBoxStyle.Information)
    Exit Sub
    End If

    You will have to do these tings for each control on the form

    .........

    Next post was the screenshot code...

    VB Code:

    Code:
    Dim graph As Graphics = Nothing Try
    Dim frmleft As System.Drawing.Point = Me.Bounds.Location
    Dim bmp As New Bitmap(Me.Bounds.Width + 8, Me.Bounds.Height + 8)

    graph = Graphics.FromImage(bmp)

    Dim screeny As Integer = frmleft.Y

    graph.CopyFromScreen(screenx - 5, screeny - 5, 0, 0, bmp.Size)

    ' Save the Screenshot to a file
    bmp.Save("C:\temp.png")

    bmp.Dispose()
    graph.Dispose()You may change the path of the saving file path.
    After you save the screen shot you can put this file as an attachment to the email.

    Pieter


    Will this work for my application (VB 6.5 using Microsoft Office) ? Thanks again!!!

    Ryan

  3. #3
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Need some help with gathering form data via screenshot...

    Will this work for my application (VB 6.5 using Microsoft Office) ?
    dd you try it? why not? i assume this code is in access application? what version of access?
    i doubt it will work for you
    you can use a method from microsoft to copy the form window into the clipboard then save as file, but i would have thought it would have been more efficient to parse the content of the form to a string and include in the email body
    as the body can contain html, it could be as text or formatted html table, it depends what the receiver of the email is required to do with the infomation, as some sort of text, it can directly inserted into a database or whatever, as an image it is only suitable for human consumption
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    New Member
    Join Date
    Aug 12
    Posts
    13

    Re: Need some help with gathering form data via screenshot...

    Quote Originally Posted by westconn1 View Post
    dd you try it? why not? i assume this code is in access application? what version of access?
    i doubt it will work for you
    you can use a method from microsoft to copy the form window into the clipboard then save as file, but i would have thought it would have been more efficient to parse the content of the form to a string and include in the email body
    as the body can contain html, it could be as text or formatted html table, it depends what the receiver of the email is required to do with the infomation, as some sort of text, it can directly inserted into a database or whatever, as an image it is only suitable for human consumption
    How do I do this part you mentioned "parse the content of the form to a string and include in the email body"???

    Thanks!

  5. #5
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Need some help with gathering form data via screenshot...

    How do I do this part you mentioned
    get the information from each textbox and add to a string or array

    maybe like
    vb Code:
    1. for a c in me.controls    'all controls
    2.   if typename(c) = Textbox then    ' only work with texboxes
    3.     mystr = mystr & c.name & "=" & c.text & vbnewline
    4.   end if
    5. next
    6. objmessage.body = mystr & "message submitted from xxx @ " & now
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    New Member
    Join Date
    Aug 12
    Posts
    13

    Re: Need some help with gathering form data via screenshot...

    Quote Originally Posted by westconn1 View Post
    get the information from each textbox and add to a string or array

    maybe like
    vb Code:
    1. for a c in me.controls    'all controls
    2.   if typename(c) = Textbox then    ' only work with texboxes
    3.     mystr = mystr & c.name & "=" & c.text & vbnewline
    4.   end if
    5. next
    6. objmessage.body = mystr & "message submitted from xxx @ " & now
    Thank you so much for helping... I will try it now... I have been trying to make this work all day!!!

  7. #7
    New Member
    Join Date
    Aug 12
    Posts
    13

    Re: Need some help with gathering form data via screenshot...

    Quote Originally Posted by VBFinanceGuy79 View Post
    Thank you so much for helping... I will try it now... I have been trying to make this work all day!!!
    for a c in me.controls s giving me an error" everytime?

  8. #8
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Need some help with gathering form data via screenshot...

    typo there, dunno how that could happen
    should be
    for each c in me.controls
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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