这是我写方法里的代码,就是机器下压时会调用这个updateMeasurementListView();但是调用完成后datagridview并没有显示。
但是我单独在按钮里调用这些代码就可以在datagridview里面显示,请问为什么呢?
private void updateMeasurementListView(int countco)
{
try
{
string jsonParas = "workorder_id=" + 4 + "&" + "product_id=" + 1 + "&" + "process_no=" + 10 + "&" + "process_no_order=" + 2 + "&" +
"L=" + trialValues[0] + "&" + "a=" + trialValues[1] + "&" + "b=" + trialValues[2] + "&" +
"standard_id=" + 1 + "&" + "color=" + "红色" + "&" + "address_no=" + 8 + "&";
string url = "XXXXXXXXXXXXXXXXXXXXXXXX";
string getJson = HttpUitls.Post(url, jsonParas, "POST");
JObject jt = JObject.Parse(getJson);
int judge = (int)jt["data"]["is_show"];
if (judge == 1)
{
DataTable x = JsonToDataTable(getJson);
dataGridView1.DataSource = x;
dataGridView1.Rows[0].Selected = false;
}
}
catch
{
}
}