Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8217125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:21:42+00:00 2026-06-07T12:21:42+00:00

I know I seem to ask the same types of questions but with much

  • 0

I know I seem to ask the same types of questions but with much trial and error I finally got my app to do what I needed it to do. I have a form with a button on it. When clicked it creates a form, a web browser, a picture box, a text box, and a button.

The web browser, picture box, textbox, and the button are all placed onto this form at run time.

My question is now how can I encapsulate this to be used over and over again. I’ve tried just putting this into a class and creating an instance of the class but I keept getting an error on my document completing stating my code isn’t referring to an object.

But here is my code.

Thanks

Public Class CaptchaWindow
Dim myform As New Form
Dim webbrowser As New WebBrowser
Dim picturebox As New PictureBox
Dim textbox As New TextBox
Dim submitbtn As New Button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProfileMaker.Show()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call myspecs()


AddHandler submitbtn.Click, AddressOf captchasubmit
AddHandler webbrowser.DocumentCompleted, AddressOf webcompleteddesignfloat
webbrowser.Navigate("http://www.designfloat.com/register/")

End Sub

Sub myspecs()


'FORM SIZE AND LOCATION
myform.Size = New Drawing.Size(1542, 771)
myform.Location = New Drawing.Point(15, 15)

'WEBBROWSER SIZE AND LOCATION
webbrowser.Size = New Drawing.Size(1000, 577)
webbrowser.Location = New Drawing.Point(12, 181)
webbrowser.ScriptErrorsSuppressed = True

'PICTUREBOX SIZE AND LOCATION
picturebox.Size = New Drawing.Size(299, 83)
picturebox.Location = New Drawing.Point(12, 12)
picturebox.BorderStyle = BorderStyle.Fixed3D


'TEXBOX SIZE AND LOCATION
textbox.Size = New Drawing.Size(299, 20)
textbox.Location = New Drawing.Point(12, 101)

'BUTTON SIZE AND LOCATION
submitbtn.Size = New Drawing.Size(75, 23)
submitbtn.Location = New Drawing.Point(118, 127)
submitbtn.Text = "Submit"

myform.Controls.Add(webbrowser)
myform.Controls.Add(picturebox)
myform.Controls.Add(textbox)
myform.Controls.Add(submitbtn)
myform.Show()




End Sub

Sub webcompleteddesignfloat()
For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("input")
If element.GetAttribute("name") = "reg_username" Then
element.SetAttribute("value", ProfileMaker.Username.Text)
End If
Next

For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("input")
If element.GetAttribute("name") = "reg_email" Then
element.SetAttribute("value", ProfileMaker.Email.Text)
End If
Next

For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("input")
If element.GetAttribute("name") = "reg_password" Then
element.SetAttribute("value", ProfileMaker.Password.Text)
End If
Next

For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("input")
If element.GetAttribute("name") = "reg_password2" Then
element.SetAttribute("value", ProfileMaker.Password.Text)
End If
Next

If webbrowser.ReadyState = WebBrowserReadyState.Complete Then
For Each Captcha As HtmlElement In webbrowser.Document.Images
If Captcha.GetAttribute("src").Contains("http://www.google.com/recaptcha/api/image?    c=") Then
picturebox.Load(Captcha.GetAttribute("src"))
End If
Next
End If


End Sub

Sub captchasubmit()

If webbrowser.ReadyState = WebBrowserReadyState.Complete Then
For Each Captcha As HtmlElement In webbrowser.Document.Images
If Captcha.GetAttribute("src").Contains("http://www.google.com/recaptcha/api/image?c=") Then
picturebox.Load(Captcha.GetAttribute("src"))
End If
Next
End If

For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("input")
If element.GetAttribute("id") = "recaptcha_response_field" Then
element.SetAttribute("value", textbox.Text)
End If
Next

For Each element As HtmlElement In webbrowser.Document.GetElementsByTagName("button")
If element.GetAttribute("name") = "submit" Then
element.InvokeMember("click")
End If
Next


myform.Dispose()

End Sub

The below part is when I tried to create an instance of this from a class.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim mystuff As New CaptchaClass
mystuff.Handler()
mystuff.captchasubmit()
mystuff.webcompleteddesignfloat()


End Sub
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:21:44+00:00Added an answer on June 7, 2026 at 12:21 pm

    You should Imports your class namespace to the current scope (page) at the beggining of the code

    Imports Namespace.CaptchaWindow
    
    Class Page1
    
    
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim mystuff As New CaptchaClass
    End Sub
    
    End Class
    

    Also look at Namespaces if you doesn’t know what it is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this might seem trivial for me to ask but.. I have some
I know this might seem like a duplicate, but I'm not getting anywhere with
I know this can seem a weird question but for me it would be
I know this might seem a controversial question but it really is not meant
I know this might seem strange on the face on it but, if I
I know this might seem odd for many Silverlight professionals, but alas, thats the
I know this may seem like a math question but i just saw this
I know this is probably something simple but I can't seem to find anything
I know this question might be little silly but I can't seem to find
I know this a stupid question to ask, but I was going through a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.