agaitan026
agaitan026
Explore posts from servers
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
i should redo all with httpclient then
20 replies
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
i see
20 replies
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
sfDataGrid1.DataSource = GetRESTData("http://45.237.184.122:4000/clientes?limit=10");
this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "idclave_nombre" });
}

private JObject GetRESTData(string uri)
{
var webRequest = (HttpWebRequest)WebRequest.Create(uri);
var webResponse = (HttpWebResponse)webRequest.GetResponse();
var reader = new StreamReader(webResponse.GetResponseStream());
string data = reader.ReadToEnd();
return JsonConvert.DeserializeObject<JObject>(data);

}
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
sfDataGrid1.DataSource = GetRESTData("http://45.237.184.122:4000/clientes?limit=10");
this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "idclave_nombre" });
}

private JObject GetRESTData(string uri)
{
var webRequest = (HttpWebRequest)WebRequest.Create(uri);
var webResponse = (HttpWebResponse)webRequest.GetResponse();
var reader = new StreamReader(webResponse.GetResponseStream());
string data = reader.ReadToEnd();
return JsonConvert.DeserializeObject<JObject>(data);

}
}
}
20 replies
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
just learning
20 replies
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
was a sample provided 😦
20 replies
CC#
Created by agaitan026 on 1/13/2024 in #help
issues loading winform with api rest
any reason i should use httpclient? is faster?
20 replies