hi,

i have agridview in desktop application, i fill it with data using dataset, how can i chose arow from gridview and make right click on that cell then do search for that info i chosed from gridview?

Best Regards,
IT_Techno

Recommended Answers

All 3 Replies

U may Use ContexMenu of .NET

Beside a ContextMenu, you could make use of the following events:

 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
           // this will only work if the cell has content in it
           // use  e.ColumnIndex and e.RowIndex determine the cell clicked

        }

        private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
        {
            // use if (e.Button == System.Windows.Forms.MouseButtons.Right) { your code here...

        }

        private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            // This event has e.Button, e.ColumnIndex and e.RowIndex so this is what I should use

        }

thanks for every one, you helped me :), ihave used ContexMenu and it's work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.