Reputation: 565
I have created a form in VB.net, where on-click of a button multiple variables are passed to a web service. My code is as below :
Imports MySql.Data.MySqlClient
Imports OutlookAddIn2.mantistest
Dim QService As New MantisConnectPortTypeClient
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim value1 As String
Dim value2 As String
Dim value3 As String
Dim value4 As String
Dim viewstate As String
value1 = Project_Name.SelectedItem.ToString()
value2 = ComboBox2.SelectedItem.ToString()
value3 = ComboBox3.SelectedItem.ToString()
value4 = TextBox4.Text
Dim s As String = String.Format("Value 1: {0} value2 : {1} value3: {2} value4: {3}", value1, value2, value3, value4)
Windows.Forms.MessageBox.Show(s)
TextBox1.Text = QService.mc_issue_add(username:="**", password:="**", issue:="view_state:{0} project{1}")
End Sub
The input parameters of my web service are :
When I try to put them in following ways I get the following errors :
issue:=("Category:{0} project{1}",value1, value2)
Error : value1
saying that a named argument is expected.TextBox1.Text = QService.mc_issue_add(username:="**", password:="**", view_state:=value1, Project:=value2)
Error : Argument not specified for parameter issue
of public function QService.mc_issue_add(Username as String, Password as String, issue as mantistest.Issuedata)As string
Where have I gone wrong? I have tried using other arguments with single input values and it works fine. Appreciate any assistance.
Upvotes: 1
Views: 1204
Reputation: 565
I had to describe the fields separately like this
Dim mantNote As IssueData
mantNote = New IssueData
Dim idField As String
idField = " "
Dim view_stateField As ObjectRef
view_stateField = New ObjectRef
view_stateField.id = 10
view_stateField.name = " "
Dim last_updatedField As Date
last_updatedField = Date.FromOADate(6 / 6 / 2016)
Dim projectField As ObjectRef
projectField = New ObjectRef
projectField.id = 1
projectField.name = "test"
Dim categoryField As String
categoryField = "test"
and add them under 1 description
mantNote.id = idField
mantNote.view_state = view_stateField
mantNote.last_updated = last_updatedField
mantNote.project = projectField
mantNote.category = categoryField
TextBox1.Text = QService.mc_issue_add(username:=" ", password:=" ", issue:=mantNote)
Upvotes: 1