Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Conversion from C# to VB inserting "Key" ???

In my following code (partial) the conversion adds  "Key ."
Which gives me an error on code in VB.
How do I handle this?

THIS CODE
                    using (SJVServiceClient client2 = new SJVServiceClient())
                    {
                        SearchResult res2 = new SearchResult();
                        res2 = client.GetResult(new GetResultRequest
                        {
                            RequestID = requestID,
                            Authentication = new Authentication
                            { UserName = "username", Password = "password6" }
                        });

                        if (res2.ProductResult != null)
                        {
                            var json = JsonConvert.SerializeObject(res2);
                            lblJason.Text = json.ToString();
                        }
                    }

Open in new window


Produces THIS CODE
Using client2 As New SJVServiceClient()
	Dim res2 As New SearchResult()
	res2 = client.GetResult(New GetResultRequest() With { _
		[b]Key [/b].RequestID = requestID, _
		Key .Authentication = New Authentication() With { _
			Key .UserName = "username", _
			Key .Password = "password" _
		} _
	})

	If res2.ProductResult IsNot Nothing Then
		Dim json = JsonConvert.SerializeObject(res2)
		lblJason.Text = json.ToString()
	End If
End Using

Open in new window

Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Remove html codes..  from your produced code.try now.

Using client2 As New SJVServiceClient()
	Dim res2 As New SearchResult()
	res2 = client.GetResult(New GetResultRequest() With { _
		Key.RequestID = requestID, _
		Key.Authentication = New Authentication() With { _
			Key .UserName = "username", _
			Key .Password = "password" _
		} _
	})

	If res2.ProductResult IsNot Nothing Then
		Dim json = JsonConvert.SerializeObject(res2)
		lblJason.Text = json.ToString()
	End If
End Using

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Larry Brister
Larry Brister
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Found my own solution