PDA

View Full Version : foreach entry { entry.text = ""; } - need help with this..)



dinbrca
June 27th, 2008, 10:12 PM
I have tried to use the foreach loop to make every entry in the window to "" here is the code:


foreach (Gtk.Entry f in this)
{
f.Text = "";
}

what's wrong with it?

-grubby
June 27th, 2008, 11:04 PM
Perhaps change
f.Text = ""; to
f.Text = " ";?

dinbrca
June 27th, 2008, 11:09 PM
no it isn't the problem..

-grubby
June 27th, 2008, 11:12 PM
no it isn't the problem..

Ok, I was just trying to help..

Can+~
June 27th, 2008, 11:32 PM
I think it is set_text(""), although I only use pyGTK (http://www.pygtk.org/pygtk2reference/class-gtkentry.html) (click for the reference)

dinbrca
June 27th, 2008, 11:35 PM
nathangrubb i wasnt angry at you..
can+ I dont use Python

Can+~
June 27th, 2008, 11:48 PM
nathangrubb i wasnt angry at you..
can+ I dont use Python

I know you don't use it, but I thought it would be the same method :KS.

cdekter
June 28th, 2008, 03:15 AM
What is the actual error/problem you are getting? Need more info...

slavik
June 28th, 2008, 05:29 AM
I have tried to use the foreach loop to make every entry in the window to "" here is the code:


foreach (Gtk.Entry f in this)
{
f.Text = "";
}

what's wrong with it?
what language are you using?

dinbrca
June 28th, 2008, 01:09 PM
i am using C#

cdekter
June 28th, 2008, 02:21 PM
I'm kinda guessing based on my experience with Windows Forms in C#... but I don't think you can iterate over the controls in a window like that. A Window is not a collection. You will need to set the Text property for each GtkEntry in your Window separately (unless of course you previously added all of them to some collection you are maintaining elsewhere).