|
hey guys...i have a textbox which is in panel..i want to clean all textboxes' text property with a button click in my Form..to do that i created a method but it doesnt clean the text of the textbox which is in panel..the method is below
foreach (Control item in this.Controls)
{
if (item.GetType() == typeof(TextBox))
((TextBox)item).Text = null;
}
how i can reach the textbox inside the panel ?
|
|
|
|
|
Message Closed
modified 23-Nov-14 5:53am.
|
|
|
|
|
hey friend..thanks for your reply..i want to ask one more question
it works if i have one panel but what about if i have more than one..i mean one panle and a textbox in it..and one more panle and textbox inside and so on..
|
|
|
|
|
Off the top of my head, this should clear the value of all the text boxes in a form:
private void ClearTextboxes(Form parentForm)
{
foreach (Control childControl in parentForm.Controls)
{
ClearTextboxes(childControl);
}
}
private void ClearTextboxes(Control control)
{
foreach(Control childControl in control.Controls)
{
ClearTextboxes(childControl );
}
TextBox textBox = control as TextBox;
if (textBox != null)
{
textBox.Text = string.Empty;
}
}
|
|
|
|
|
thanks freind for your help..it works now as i wish.
|
|
|
|
|
You're welcome. You could boil it down to one generic method if you liked, but this should work as is.
|
|
|
|
|
A Form can be a hierarchy of Controls, as some Controls may contain other Controls (see Control.Controls property). The general solution is using a recursion, much the same you would use when looking for all .doc files on your disk.
|
|
|
|
|
Making an userinterface like a media player GUI without using WPF. Can any one help me how to create it.. or else just give the some examples...
|
|
|
|
|
What you are looking to do is skin a .NET form. You can find more information by following the links[^] in Google.
|
|
|
|
|
|
5!
This was the only reply that addressed the OP's poorly worded question. Thanks Pete.
|
|
|
|
|
|
"Atractive" is subjective (beauty is in the eye of the beholder). I'd be more worried about maintaining a standard (and more importantly, consistent) interface.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
dileepkumar1244 wrote: Making an userinterface like a media player GUI without using WPF
If you can't use WPF, you pretty much have to use Winforms, use a browser or abandon .net
dileepkumar1244 wrote: Can any one help me how to create it.. or else just give the some examples
This is why I voted 1:
- Beauty is subjective and [partially or mostly???] cultural.
- Open some apps you like the look of, figure out what makes them nice, replicate the ideas. Not hard to figure out
- There isn't really a programming question there
- You ask for examples without having tried anything.
|
|
|
|
|
I have to agree with Keith - his four reason cover nearly all of mine. But I would add this:
"Attractive" is going to depend on what you are producing. An app to rip MP3's, mash 'em together and scratch the result is going to have a vastly different audience view to the monitoring software for a nuclear power station. The latter is not going to want hexagonal text boxes and see-though buttons so the background image is easily visible. But it is going to want a clear display of the core temperature, and output megawatts.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
You'll need buttons that the user wants to lick.
|
|
|
|
|
GUI design is trade in it self that requers much experience,
Amazone'd it for ya'
when it comes to the technical side of implementing a nice GUI in C# you could a) create your own custom controls using GDI+ or b) by a set of 3rd party controls like telerik WinForms.
|
|
|
|
|
pls i want to implement a private method on an interface,
and i get the Error:
Class cannot implement an interface member because it is not public.
I am creating a COM Object in c# and the mthods of my calss must be protected.
Pls is there another way of doing this.
Thanks.
|
|
|
|
|
You can't. If you think about it, it makes sense. The method wouldn't be accessible to consumers of the interface so it would be pointless.
|
|
|
|
|
You can't it is against the language syntax because, as DaveyMnn said, it wouldn't make sense. Interfaces are there to define members that are publically available in the class.
If you want to protect code from external use it cannot be part of the Interface. You can however call private or protected methods (which cannot be in the Interface) from your public ones (which can).
|
|
|
|
|
Perhaps you should sit back and reflect on the word "interface".
|
|
|
|
|
it shares 5 letters with private, and only 2 with public.
|
|
|
|
|
And yet is shares 6 with in-your-face.
|
|
|
|
|
I'd say 7, but you're trying to change the subject here.
|
|
|
|
|
PIEBALDconsult wrote: reflect on the word "interface".
ecafretni? I doubt that'll help him much
|
|
|
|