简体   繁体   English

有人可以为我提供有关C#Datagridview双击行的帮助

[英]Someone can help me about c# datagridview double click row

I had a form which had a datagridview.I want if I double click at one row,another form will show. 我有一个具有datagridview的表单。我想如果我双击一行,将显示另一种表单。 Someone can help me. 有人可以帮助我。 Sorry because my English is not good. 对不起,因为我的英语不好。

You should handle the CellDoubleClick event. 您应该处理CellDoubleClick事件。

public Form1()
{
    InitializeComponent();
    DataGridView1.CellDoubleClick += New DataGridViewCellEventHandler(this.DataGridView1_CellDoubleClick);
}

private void DataGridView1_CellDoubleClick(Object sender, DataGridViewCellEventArgs e)
{
    Form2 frm2 = new Form2();
    frm2.ShowDialig(); //To Show window as a dialog
    //frm2.Show(); //Normal window
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有人可以在C#中帮我解决这个问题吗 - Can someone help me solve this in c# 有人可以在C#中帮助我处理数组吗? - Can someone help me with arrays in c#? 双击DataGridView行并在C#中的另一个DataGridView中显示列 - Double click in DataGridView row and display columns in another DataGridView in C# 我如何在 C# 中执行它有人可以帮助我 - how can i execute this in C# can someone help me 有人可以使用C#统一代码为我的测验游戏提供帮助吗 - Can someone help me in my Quiz Game using C# unity code 有人可以帮我确定为什么 C# 工具提示不应该显示吗? - Can someone help me identify why C# tooltips show when they shouldn't? 有人可以帮我重构C#linq业务逻辑以提高效率吗? - Can someone help me refactor this C# linq business logic for efficiency? 有人可以帮我将这个用C#编写的正则表达式转换为javascript吗? - Can someone help me to convert this regex expression written in C# to javascript? 在此特定示例(IP地址表达式)中,有人可以帮助我比较使用F#和C#吗? - Can someone help me compare using F# over C# in this specific example (IP Address expressions)? 有人可以帮我修改此代码,使其在 C# ASP.NET 中工作吗? - Can someone help me to modify this code so it works in C# ASP.NET?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM