Users Pricing

forum

Home Forums How to display data results in DatagridView in another Form? – MindStick

How to display data results in DatagridView in another Form?

Pravesh Singh 2798 20 Oct 2014
I'm having a tough time trying to display my data information in another form which has a DataGridView, if a button is clicked
 
To display the results in the same Form in dgv isn't a problem but to display it in Form 2 in a dgv is giving me a headache (:
 
Example:
Form1
cmd.commandText: SELECT * FROM tblproducts
 
void btnDisplay_Click(object sender, EventArgs e)
 
if (comboBox1.SelectedValue.ToString() != null && comboBox2.SelectedValue.ToString() != null)
 
try 
open connection
new Form2().ShowDialog();
 
?????? what next??
 
Form2
 
dataGridView1.DataSource = get Info from Form1;

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md