我如何使用参数自定义网址? 在我的示例中,我有3个参数
Textbox1.Text = "Ikea"
Textbox2.Text = "Table"
Textbox3.Text = "Black"
最终网址应类似于:
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
谢谢。
答案 0 :(得分: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