-1

我如何自定义带有参数的 url?在我的示例中,我有 3 个参数

Textbox1.Text = "Ikea"
Textbox2.Text = "Table"
Textbox3.Text = "Black"

最终的 url 需要像:

https://localhost/objects?color=Black&manufacturer=Ikea&type=Table

在 Textbox4.Text 中。

那么我如何添加先前文本框的先前值呢?目前我有:

Private Sub FinalScrapper_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox1.Text = "Ikea"
    TextBox2.Text = "Table"
    TextBox3.Text = "Black"

    TextBox4.Text = ("https://localhost/objects?color=Black&manufacturer=Ikea&type=Table")
    'The correct parameters are something like that ?
    'TextBox4.Text = ("https://localhost/objects?color=TextBox3.Text&manufacturer=TextBox1.Text&type=TextBox2.Text")
End Sub

谢谢。

4

1 回答 1

1

我按照评论中的建议使用了插值字符串,以下内容对我有用:

Private Sub FinalScrapper_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox1.Text = "Ikea"
    TextBox2.Text = "Table"
    TextBox3.Text = "Black"

    Dim manufacturer = TextBox1.Text
    Dim type = TextBox2.Text
    Dim color = TextBox3.Text

    Dim s1 = $"https://localhost/objects?color={color}&manufacturer={manufacturer}&type={type}"
    TextBox4.Text = s1
End Sub
于 2019-09-28T19:51:56.407 回答