VB.NET WEB FORMS Inner text

hi all.
i have a problem.
On webForm I must insert text to this textarea.
1st:
<input class="pledge_level_other" name="PledgeLevelOther" value="" onchange="liltype.ifaw.setDonationOther(this.form);" type="text" maxlength="12" size="12">

Open in new window

2nd:
<input type="text" size="35" maxlength="250" name="first_name" value="">

Open in new window

And 3hd i need to click the button
<input type="button" name="SubmitButton" id="SubmitButton" value="Submit" onclick="SubmitForm285190(form);" class="HtmlButton">

Open in new window

I use Webbrowser.
Replica178Asked:
Who is Participating?
 
käµfm³d 👽Commented:
It doesn't work because that section of the page is actually a frame, and as such, is basically it's own separate page. Try navigating to the frame's address: WebBrowser1.Navigate("https://www.kintera.org/site/c.kiKSL4PNLvF/b.4423519/k.D6A4/Donation/apps/ka/sd/donor.asp?c=kiKSL4PNLvF&b=4423519&en=ckIRL3MIKaKMLbOXJeKMI9PRKmK7IeOMKhITI2OKLeITL8OWLyF#scrollup&")
0
 
käµfm³d 👽Commented:
Try the following:
Dim inputs As HtmlElementCollection = Me.WebBrowser1.Document.GetElementsByTagName("input")

For Each element As HtmlElement In inputs
    If element.Name = "PledgeLevelOther" Then
        element.InnerText = "some text to enter"
    ElseIf element.Name = "first_name" Then
        element.InnerText = "my name"
    End If
Next

Dim button As HtmlElement = Me.WebBrowser1.Document.GetElementById("SubmitButton")

If button IsNot Nothing Then
    button.InvokeMember("click")
End If

Open in new window

0
 
Replica178Author Commented:
Not Working(
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
CodeCruiserCommented:
Where did you put that code? It needs to go into Webbrowser1_DocumentCompleted event and add a check to make sure that document has fully loaded.
0
 
CodeCruiserCommented:

    Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If WebBrowser1.ReadyState = System.Windows.Forms.WebBrowserReadyState.Complete Then
           'Above Code
        End if
End Sub
0
 
Replica178Author Commented:
I put it into the button
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim inputs As HtmlElementCollection = Me.WebBrowser1.Document.GetElementsByTagName("input")

        For Each element As HtmlElement In inputs
            If element.Name = "PledgeLevelOther" Then
                element.InnerText = "some text to enter"
            ElseIf element.Name = "first_name" Then
                element.InnerText = "my name"
            End If
        Next

        Dim button As HtmlElement = Me.WebBrowser1.Document.GetElementById("SubmitButton")

        If button IsNot Nothing Then
            button.InvokeMember("click")
        End If
    End Sub

Open in new window

0
 
CodeCruiserCommented:
And you are sure that the page is fully loaded? Did you step through the code?
0
 
Replica178Author Commented:
yes.i'm sure
0
 
CodeCruiserCommented:
>Did you step through the code?
And which lines are executing?
0
 
Replica178Author Commented:
it's all my code
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim inputs As HtmlElementCollection = Me.WebBrowser1.Document.GetElementsByTagName("input")

        For Each element As HtmlElement In inputs
            If element.Name = "PledgeLevelOther" Then
                element.InnerText = "some text to enter"
            ElseIf element.Name = "first_name" Then
                element.InnerText = "my name"
            End If
        Next

        Dim button As HtmlElement = Me.WebBrowser1.Document.GetElementById("SubmitButton")

        If button IsNot Nothing Then
            button.InvokeMember("click")
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("https://www.ifaw.org/ifaw_russia/donate_now/index.php#x")
    End Sub
End Class

Open in new window

0
 
CodeCruiserCommented:
I try again with my questions

Did you step through the code in button click?
And which lines are executing?
0
 
Replica178Author Commented:
i have tried  to do it step by step with 2 buttons.but it's not working.
0
 
CodeCruiserCommented:
Steping through the code means set a break point at a specific line and then executing one line of code at a time to see what code is executing and whether if conditions are returning true or false etc.

http://www.youtube.com/watch?v=jxR_ngGIpQM
0
 
Replica178Author Commented:
Thank You Very Much
0
 
Replica178Author Commented:
Thanks
0
 
käµfm³d 👽Commented:
NP. Glad to help  = )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.