[Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )

countcb count.cb at gmx.net
Fri Jun 27 04:18:15 EDT 2008

Werner666 wrote:
> [code]
> TreeIter iter;
> TreeModel model;
> TreePath path = ((TreeSelection)sender).GetSelectedRows();
> this.klantListStore.GetIter(out iter, path[0]);
> Console.WriteLine(path[0]);
> klantListStore.Remove(ref iter);
> [/code]

The Exception is in the OnButton2Clicked Method.
Is the code you posted above inside this OnButton2Clicked Method?
If yes, sender is the button you clicked on. So you tried to cast a button
to a TreeSelection. That's why you get a InvalidCastException.
View this message in context: http://www.nabble.com/Treeview%2C-delete-the-selected-row-%28can%27t-get-it-done-%3A%28-%29-tp18144085p18150331.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list