c#
DoubleClick on DataGridView to get more informations
Does anybody know how to make, when you double click on a cell in DataGridView a messagebox appears with more information. So for example i want my DataGridView to only display name and surname but when you Double Click it a messagebox appears with more information like age, heght... Thanks for your help!
First you are going to need to subscribe to the 'CellDoubleClick' event like so: yourDataGridView.CellDoubleClick += yourDataGridView_CellDoubleClick(); This will cause you program to start listening for the double click. In the same class, you have to define the behavior that you want when the DataGridView is double clicked. The DataGridViewCellEventArgs parameter has values for the current row (e.RowIndex) and the current column (e.ColumnIndex). Here is an example using one of my DataGridViews: private void dgvContacts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //Make sure that the user double clicked a cell in the main body of the grid. if (e.RowIndex >= 0) { //Get the current row item. Contact currentContact = (Contact)dgvContacts.Rows[e.RowIndex].DataBoundItem; //Do whatever you want with the data in that row. string name = currentContact.Name; string phoneNum = currentContact.Phone; string email = currentContact.Email; MessageBox.Show("Name: " + name + Environment.NewLine + "Phone number: " + phoneNum + Environment.NewLine + "Email: " + email); }//if }//dgvContacts_CellDoubleClick
Related Links
Good parsing approach after tokenization [closed]
Logging in Microsoft Azure TableController
Couldn't zip blank text file (size 0KB) in UWP (Windows 10 App) C#
Print Document pdf c#
System.Drawing.FontFamily does not accept Uri-based Font
Adding search function to an invoice application
How Do I Set Z-Index in an ItemsControl with a Data Binding?
How to accept values as doubles in a textbox in ASPX C# Website?
Searching for Singular and Plural of a word in Search Engine
Unable to re-assign JavaScript variables with new Razor data?
Handle inconsistent date format string conversion to DateTime
Display Graph with Vertices and Edges in UWP
MvvmLight Messaging - What is the proper way to register and unregister a message?
Validation error message displays the entire text of the property in Asp.Net MVC 5
Add ListView item to a simple list?
Google Datastore authentication issue - C#