0
I would like to pass the result of this API to a TextBox
. I’m having a hard time getting the information from this class to the graphic part.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Http;
namespace WindowsFormsApplication3
{
static class Program
{
static async Task<string> LookupMac(string MacAddress)
{
var uri = new Uri("http://api.macvendors.com/" + WebUtility.UrlEncode(MacAddress));
using (var wc = new HttpClient())
return await wc.GetStringAsync(uri);
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
foreach (var mac in new string[] { "88:53:2E:67:07:BE", "FC:FB:FB:01:FA:21", "D4:F4:6F:C9:EF:8D" })
Console.WriteLine(mac + "\t" + LookupMac(mac).Result);
Console.ReadLine();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Explain your problem.
– Wictor Chaves
I would like to pass on to a Textbox the information that this API is returning!
– Marcos Wilian
I am not able to pass the information to the form to manipulate them!
– Marcos Wilian
You better put the code in the form load event.
– Francisco
@Marcoswilian solved?
– Leandro Angelo
Solved! Thank you
– Marcos Wilian