mail-archives/gtk-sharp-list/2008-June/008761.html

89 строки
3.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Treeview%2C%0A%20delete%20the%20selected%20row%20%28can%27t%20get%20it%20done%20%3A%28%20%29&In-Reply-To=18144085.post%40talk.nabble.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="008777.html">
<LINK REL="Next" HREF="008762.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )</H1>
<B>countcb</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Treeview%2C%0A%20delete%20the%20selected%20row%20%28can%27t%20get%20it%20done%20%3A%28%20%29&In-Reply-To=18144085.post%40talk.nabble.com"
TITLE="[Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )">count.cb at gmx.net
</A><BR>
<I>Fri Jun 27 04:18:15 EDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="008777.html">[Gtk-sharp-list] ScrolledWindow and TextView
</A></li>
<LI>Next message: <A HREF="008762.html">[Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8761">[ date ]</a>
<a href="thread.html#8761">[ thread ]</a>
<a href="subject.html#8761">[ subject ]</a>
<a href="author.html#8761">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
Werner666 wrote:
&gt;<i>
</I>&gt;<i>
</I>&gt;<i> [code]
</I>&gt;<i> TreeIter iter;
</I>&gt;<i> TreeModel model;
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> TreePath path = ((TreeSelection)sender).GetSelectedRows();
</I>&gt;<i> this.klantListStore.GetIter(out iter, path[0]);
</I>&gt;<i> Console.WriteLine(path[0]);
</I>&gt;<i>
</I>&gt;<i> klantListStore.Remove(ref iter);
</I>&gt;<i> [/code]
</I>&gt;<i>
</I>
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: <A HREF="http://www.nabble.com/Treeview%2C-delete-the-selected-row-%28can%27t-get-it-done-%3A%28-%29-tp18144085p18150331.html">http://www.nabble.com/Treeview%2C-delete-the-selected-row-%28can%27t-get-it-done-%3A%28-%29-tp18144085p18150331.html</A>
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="008777.html">[Gtk-sharp-list] ScrolledWindow and TextView
</A></li>
<LI>Next message: <A HREF="008762.html">[Gtk-sharp-list] Treeview, delete the selected row (can't get it done :( )
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8761">[ date ]</a>
<a href="thread.html#8761">[ thread ]</a>
<a href="subject.html#8761">[ subject ]</a>
<a href="author.html#8761">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>