void addDataToGridView(resValidateFakturPm efaktur) { BindingSource gvBs = (BindingSource)dataGridView1.DataSource; if (gvBs == null) { BindingSource newBs = new BindingSource(); newBs.DataSource = typeof(resValidateFakturPm); newBs.Add(efaktur); dataGridView1.DataSource = newBs; dataGridView1.AutoGenerateColumns = true; } else { gvBs.Add(efaktur); } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string response = getResponse(textBox1.Text); if (response == null) { return; } response = reformatXML(response); resValidateFakturPm efaktur = deserializeXML(response); if (efaktur.statusApproval != "Faktur Valid, Sudah Diapprove oleh DJP") { MessageBox.Show("Faktur tidak valid"); return; } addDataToGridView(efaktur); textBox1.Text = ""; } }