473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

How to convert in C# code to vb.net

Gobindap
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
BillViewModel p = new BillViewModel
{
username = "Test_CBMS", password = "test@321", seller_pan = "999999999",
buyer_pan = "123456789",
buyer_name="", fiscal_year = "2073.074", invoice_number="102",
invoice_date="2074.07.06", total_sales=1000.01,
taxable_sales_vat=1000.01, vat=130, excisable_amount=0, excise=0,
taxable_sales_hst=0,
hst=0, amount_for_esf=0, esf=0, export_sales=0,
tax_exempted_sales=0,isrealtime=true, datetimeclient = Datetime.now };
client.BaseAddress = new Uri("http://202.166.207.75:9050");
var response = client.PostAsJsonAsync("api/bill", p).Result; if
(response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync();
Console.Write(result.Result);
Console.ReadLine();
} else
{
Console.Write("Error");
Console.ReadLine();
}
}

================================================== ====
It tried it as following
Using client = New HttpClient()
client.DefaultRequestHeaders.Accept.Clear()
client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
Dim p As BillViewModel = New BillViewModel With {
.username = "Test_CBMS",
.password = "test@321",
.seller_pan = "999999999",
.buyer_pan = "123456789",
.buyer_name = "",
.fiscal_year = "2073.074",
.invoice_number = "102",
.invoice_date = "2074.07.06",
.total_sales = 1000.01,
.taxable_sales_vat = 1000.01,
.vat = 130,
.excisable_amount = 0,
.excise = 0,
.taxable_sales_hst = 0,
.hst = 0,
.amount_for_esf = 0,
.esf = 0,
.export_sales = 0,
.tax_exempted_sales = 0,
.isrealtime = True,
.datetimeClient = DateTime.Now
}
client.BaseAddress = New Uri("http://202.166.207.75:9050")

'Dim response = client.PutAsync("api/bill", p).Result

Dim response = client.PostAsJsonAsync("api/bill", p).Result
If response.IsSuccessStatusCode Then
Dim result = response.Content.ReadAsStringAsync()
Console.Write(result.Result)
Console.ReadLine()
Else
Console.Write("Error")
Console.ReadLine()
End If
End Using
==============================================
but is show error in
" Dim response = client.PostAsJsonAsync("api/bill", p).Result"

it says
'PostAsJsonAsync' is not a member of 'System.Net.Http.HttpClient'.


Please please please help me.
Thank you.
Mar 15 '18 #1
1 1553
Today, there are many online software available for code converter.Check this link http://converter.telerik.com
Mar 15 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Graham Feeley | last post by:
Hi I have data resembling like this Clearing, The Italian Job, The Final Cut, The Manson Family, The I would like some code to convert the data to The Clearing The Italian Job The Final Cut
1
by: Diego | last post by:
Hi, Anyone can help to convert this code to C#? Public Class MonImageConverter Inherits System.Windows.Forms.AxHost Public Sub New() MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B33") 'note...
8
by: Mike | last post by:
is there a tool that will convert cold fusion code to C#? Or anything out there to help in this process? thx
15
by: Tanzim Saqib | last post by:
I've been trying to learn VB.NET. I know VB6. I can not convert the following VB6 code segment to VB.NET In VB 6: ' In a module starts here: Public Declare Function SetTimer Lib "user32"...
3
by: Dushyant | last post by:
Hello everyone, I am working on converting one code from VB to VB.NET. I am stuck at some point, please help me how to convert following code from VB to VB.NET : Dim xImage As...
2
by: shapper | last post by:
Hello, Could someone, please, convert the following code line to VB.NET? bool containsValue = myList.Any(item =item.NameParameter == nameParameterValue); (This is .NET 3.5. I couldn't find...
1
by: shapper | last post by:
Hello, I am having problems in converting the following code line to VB.NET: Control list = MyFun(myControl, delegate(Control ctl) { ctl.ID == "MyControl"; }); Could someone please help me...
4
by: Sam | last post by:
I am new in software development, and need some help. Please help me convert a class written in c# to vb.net. Thanks, Sam
3
mshmyob
by: mshmyob | last post by:
I am new to vb.net and would like to be able to convert the following code to it's own function - either inside the current module or better yet in a seperate class. This code currently runs in...
2
by: royhoja | last post by:
How do i convert the following code into a function? What parameters would be in the function? printingform(???,???) #include <stdio.h> #include <string.h> int main() { int i;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.