Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
coding of form order is....
C#
public partial class Orders : Form
   {
       SqlCommand cmd;
       SqlConnection cn;
       SqlDataReader dr;

       public Orders()
       {
           InitializeComponent();
       }


       private void button1_Click(object sender, EventArgs e)
       {
           dataGridView1.Rows.Add(comboBox1.Text,comboBox3.Text, comboBox2.Text,textBox2.Text);

           }

       private void Orders_Load(object sender, EventArgs e)
       {

           cn = new SqlConnection();
           cn.ConnectionString = ConfigurationManager.ConnectionStrings["Key"].ConnectionString;
       }

       private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
       {
           Int32 val1 = Convert.ToInt32(comboBox3.Text);
           Int32 val2 = Convert.ToInt32(comboBox2.Text);
           Int32 val3 = val1 * val2;
           textBox2.Text = val3.ToString();

       }

       private void button2_Click(object sender, EventArgs e)
       {
           try
           {
               dataGridView1.Rows.RemoveAt(dataGridView1.CurrentCell.RowIndex);
           }
           catch
           {
               MessageBox.Show("Must select the row first");
           }
       }

       private void button4_Click(object sender, EventArgs e)
       {
           int sum = 0;
           for (int i=0; i < dataGridView1.Rows.Count; ++i)
           {
               sum += Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
           }
           label7.Text = sum.ToString();
       }
   }


i have another form named bill. now i want inserted data in datagridview1 of form order copied to datagridview1 of form bill when i press button at form "order"...
Posted
Updated 25-Feb-14 2:24am
v4
Comments
ZurdoDev 25-Feb-14 14:55pm    
Where are you stuck?
Member 10481714 25-Feb-14 19:24pm    
What..?
Member 10481714 27-Feb-14 16:56pm    
i want to copy data of dgv to other dgv of diff. form....!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900