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

  • Home
  • SEARCH
  • 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 8829253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:47:36+00:00 2026-06-14T07:47:36+00:00

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Dim PageInput

  • 0
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    Dim PageInput As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
    For Each elem As HtmlElement In PageInput
        If elem.GetAttribute("name") = "wdf_origin" Then
            elem.SetAttribute("value", FromTXT.Text)
        End If
        If elem.GetAttribute("name") = "wdf_destination" Then
            elem.SetAttribute("value", ToTXT.Text)
        End If
        If RadioButton1.Checked = True Then
            elem.GetAttribute("id") = "oneway" Then
            elem.SetAttribute("checked", RadioButton1.Checked) Then
            elem.GetAttribute("id") = "wdfdate1" Then
            elem.SetAttribute("value", DateTimePicker1.Text)
        End If
        If RadioButton2.Checked = True Then
            elem.GetAttribute("id") = "return" Then
            elem.SetAttribute("checked", RadioButton2.Checked) Then
            elem.GetAttribute("id") = "wdfdate1" Then
            elem.SetAttribute("value", DateTimePicker1.Text) Then
            elem.GetAttribute("id") = "wdfdate2" Then
            elem.SetAttribute("value", DateTimePicker2.Text)
        End If
    Next

    Dim PageInput2 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("select")
    For Each elem As HtmlElement In PageInput2
        If elem.GetAttribute("id") = "adults" Then
            elem.SetAttribute("value", AdultsTXT.Text)
        End If
        If elem.GetAttribute("id") = "children" Then
            elem.SetAttribute("value", ChildrenTXT.Text)
        End If
        If elem.GetAttribute("id") = "infants" Then
            elem.SetAttribute("value", InfantsTXT.Text)
        End If
        If RadioButton1.Checked = True Then
            elem.GetAttribute("id") = "wdftime1" Then
            elem.SetAttribute("value", Time1TXT.Text)
        End If
        If RadioButton2.Checked = True Then
            elem.GetAttribute("id") = "wdftime2" Then
            elem.SetAttribute("value", Time2TXT.Text) Then
            elem.GetAttribute("id") = "wdftime1" Then
            elem.SetAttribute("value", Time1TXT.Text)
        End If
    Next
End Sub

At the moment, I am getting a this error

expression is a value and therefore cannot be the target of an assignment

on the elem.GetAttribute(" ") lines. Along with it saying it expects the statement to end on some of the Thens. Can I not set certain methods within if statements so that they include certain text boxes? I’m trying to get the RadioButtons to send certain text boxes depends on which RadioButton is selected.

Any suggestions or resources would be helpful.

  • 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-14T07:47:37+00:00Added an answer on June 14, 2026 at 7:47 am

    You need to make sure that each Then has a coresponding If, also it looks like you actually need to be using the AndAlso and ElseIf operators to do what you are wanting. The reason that you are getting the “expression is a value and therefore cannot be the target of an assignment” errors are because you are trying to assign the value to your GetAttribute because of the lack of an If statement.

    See if this works better for you.

    Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Dim PageInput As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
        For Each elem As HtmlElement In PageInput
            If elem.GetAttribute("name") = "wdf_origin" Then
                elem.SetAttribute("value", FromTXT.Text)
            End If
            If elem.GetAttribute("name") = "wdf_destination" Then
                elem.SetAttribute("value", ToTXT.Text)
            End If
            If RadioButton1.Checked then
                If elem.GetAttribute("id") = "oneway" Then
                    elem.SetAttribute("checked", CStr(RadioButton1.Checked))
                ElseIf elem.GetAttribute("id") = "wdfdate1" Then
                    elem.SetAttribute("value", DateTimePicker1.Text)
                End If
            End If
    
            If RadioButton2.Checked then
                If elem.GetAttribute("id") = "return" Then
                    elem.SetAttribute("checked", RadioButton2.Checked.ToString)
                ElseIf elem.GetAttribute("id") = "wdfdate1" Then
                    elem.SetAttribute("value", DateTimePicker1.Text)
                ElseIf elem.GetAttribute("id") = "wdfdate2" Then
                    elem.SetAttribute("value", DateTimePicker2.Text)
                End If
            End If
    
        Next
    
        Dim PageInput2 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("select")
        For Each elem As HtmlElement In PageInput2
            If elem.GetAttribute("id") = "adults" Then
                elem.SetAttribute("value", AdultsTXT.Text)
            End If
            If elem.GetAttribute("id") = "children" Then
                elem.SetAttribute("value", ChildrenTXT.Text)
            End If
            If elem.GetAttribute("id") = "infants" Then
                elem.SetAttribute("value", InfantsTXT.Text)
            End If
            If RadioButton1.Checked AndAlso elem.GetAttribute("id") = "wdftime1" Then
                elem.SetAttribute("value", Time1TXT.Text)
            End If
            If RadioButton2.Checked Then
                If elem.GetAttribute("id") = "wdftime2" Then
                    elem.SetAttribute("value", Time2TXT.Text)
                ElseIf elem.GetAttribute("id") = "wdftime1" Then
                    elem.SetAttribute("value", Time1TXT.Text)
                End If
            End If
        Next
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown What is
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick If e.ColumnIndex
Private Sub cbtns_ClickButtonArea(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cbtn_a.ClickButtonArea, cbtn_b.ClickButtonArea, cbtn_c.ClickButtonArea,
Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click Dim Inputter
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim p
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim insertOk
Private Sub txtQty_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtQty.GotFocus Dim strItem
Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing e.Cancel = True Me.WindowState
My Code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

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.