Right click to select a row in a Datagridview and show a menu to delete it

I finally solved it: In Visual Studio, create a ContextMenuStrip with an item called “DeleteRow” Then at the DataGridView link the ContextMenuStrip Using the code below helped me getting it work. this.MyDataGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MyDataGridView_MouseDown); this.DeleteRow.Click += new System.EventHandler(this.DeleteRow_Click); Here is the cool part private void MyDataGridView_MouseDown(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { … Read more

Get index of selected option with jQuery

The first methods seem to work in the browsers that I tested, but the option tags doesn’t really correspond to actual elements in all browsers, so the result may vary. Just use the selectedIndex property of the DOM element: alert($(“#dropDownMenuKategorie”)[0].selectedIndex); Update: Since version 1.6 jQuery has the prop method that can be used to read … Read more

Selecting specific values on a Chart

For directly clicking on a DataPoint you can do a HitTest. But for tiny points or for a selection of a range this will not work well. The necessary functions are hidden in the Axes methods. This solution uses a regular rubber-band rectangle to select the points caught: Point mdown = Point.Empty; List<DataPoint> selectedPoints = … Read more