private void dataGrid1_DoubleClick(object sender, System.EventArgs e)
        {
            try
            {
                string str = dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString();
            
            }
            catch
            {            }
        }请指教如何才能实现双击DATAGRID里面的行后弹出一个新的界面?
上面的代码是否对,能否实现该功能。该如何调用新界面。   

解决方案 »

  1.   

    你在这个事件里New 一个窗体就可以出来一个新的界面了。
      

  2.   

     using (select er = new select(m_dt, rs))
     {
            er.ShowDialog();
     }
      

  3.   

    private void dataGrid1_DoubleClick(object sender, System.EventArgs e) 
            { 
                try 
                { 
                   string str = dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString(); 
                   Form2 frm=new Form2();//新窗体对象
                   Frm.show();
                } 
                catch (Exception ex)
                { 
                   MessageBox.Show(ex.Message);
                } 
            } 
      

  4.   

    private void dataGrid1_DoubleClick(object sender, System.EventArgs e) 
            { 
                try 
                { 
                   string str = dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString(); 
                   Form2 frm=new Form2(......顺便把数据也传过去);//新窗体对象
                   Frm.show();
                } 
                catch (Exception ex)
                { 
                   MessageBox.Show(ex.Message);
                } 
            } 
      

  5.   

    NEW一个新窗体出来后,双击后没有反应?
      

  6.   


    这样大哥说的没有问题,就是样的,你只要在Form2里构造方法里接收一下这个值就行了,
    就可以使用了
      

  7.   

    NEW一个新窗体出来后,在new的窗体中要加属性来接收你的值
      

  8.   


    private void dataGrid1_DoubleClick(object sender, System.EventArgs e) 
            { 
                try 
                { 
                   string str = dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString(); 
                   Form2 frm=new Form2(......顺便把数据也传过去);//新窗体对象
                   Frm.show();
                } 
                catch (Exception ex)
                { 
                   MessageBox.Show(ex.Message);
                } 
            }