|
I refer the honorable gentleman to my original reply:
Quote: provided they aren't inside any containers: Panel, Splitters, GroupBoxes, and so on. If they are, then you need to recurse though the container.Controls collection as well in order to find them.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I refer the honorable gentleman to my original reply Wow.
And this not the first time, you seem very patient and kind
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
See my reply on using 'GetType<> below. Call the method on YourGroupBox.Controls ... or any other ContainerControl [^]
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Normally the answer to your issue is still given ...
Perhaps additional :
What you have to do is :
- iterate throught the Controls-collection of your Form
- if the type of the control is a Textbox then do your work
- if not look if the control has entries in it's own controls-Collection
- if Yes : do the same again - please realize : your can also have a Panel inside a Panel inside a Panel ...
- also : realize that most of the controls could be also ContainerControls with controls in it
Why do the controls inside a Panel (or a GroupBox or a TabView or ...) not directly belong to the Form ? It is because there a some functions of the ConatinerControl which direct effect the cointrols in it - for example : Visible, Enable ...
But what you also can do is :
Create your own customized Control (derive it from the Control which matches most to your issue) and implement the function you need to it - for example : clear all Textboxes inside it ...
|
|
|
|
|
You can use 'OfType<> to select only cerain types of Controls:
foreach (var tb in this.Controls.OfType<TextBox>())
{
tb.Clear();
}
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Wow! Thanks for that, Bill. Good timing.
Yesterday evening I had written
bool found = false;
foreach (object obj in URIsMenu.Items)
if (obj is ToolStripMenuItem)
{
ToolStripMenuItem item = (ToolStripMenuItem)obj;
item.Checked = item.Text == SelectedItem;
if (item.Checked)
found = true;
}
Your useful reply has shortened that to
bool found = false;
foreach (ToolStripMenuItem item in URIsMenu.Items.OfType<ToolStripItem>())
{
item.Checked = item.Text == SelectedItem;
found |= item.Checked;
}
|
|
|
|
|
I was composing a reply to a QA question today [^], and I started thinking about why I made the following assumptions in C#:
1) app scoped global variables are evil
2) defining a static class outside my own/any NameSpace is evil.
Given the strongly-typed/OOP gestalt of C#, why did its designers allow something like this:
public static class Constants
{
public const double PI = Math.PI;
public static double E { set; get; } = Math.E;
}
namespace WhatEver
{} Opinions ?
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
It doesn't have to be a static class, any class can be defined outside all namespaces, in which case it's part of the default namespace: namespace keyword - C# Reference | Microsoft Docs[^]
Quote: Whether or not you explicitly declare a namespace in a C# source file, the compiler adds a default namespace. This unnamed namespace, sometimes referred to as the global namespace, is present in every file. Any identifier in the global namespace is available for use in a named namespace.
Why? You'd probably have to ask the language authors ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Why? You'd probably have to ask the language authors I would ask Mads T. if I could
But, meanwhile, I am asking for opinions, or responses, from people here, like your keenly intelligent self.
Would you ever define a Class in the "default" NameSpace ?
cheers, Bill
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Only in web sites, where it seems to be the "done thing" for some reason - the default files created for a C# web project don't include any namespaces.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
BillWoodruff wrote: I would ask Mads T. if I could
You could always try asking him on Twitter: @MadsTorgersen[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I do "cheap," but, I have never done "tweet," and, I swear, by the Hammer of King Ludd, never will.
Surely, a savant, like Thou, doesn't "tweet."
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
I’ve done it.
“Evil” is not utilizing the features and allowances of a language because someone who couldn’t hack being a programmer decides something isn’t “best practice”.
In short, if it compiles, ship it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I have 12 sets of dll for multi purpose, when I deploy the particular dll and I get this error. Please help me on this!. Mine is a C# code
|
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
How do you expect us to work out what method is missing from code we can't see, given a return type only, and with no idea what your "12 sets of dll" actually are, or how you deployed tham?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You'd have to show the whole error. But basically it's telling you that it cannot find some code that you are trying to call.
|
|
|
|
|
|
|
Hi,
I am currently working on SHA256withRSA algorithm in Window Fomrs, C#. My main objective is to get signed signature of my encrypted SHA256withRSA string with my Custom Private Key String which I generated from an online tool. In order to do that, I came to know that it happens via RSACryptoServiceProvider . Now in order to complete my sign operation I have to get the RSAParameters of my private key. And when I trying it the only part that I am getting is Modulus and Exponent part of the string. But I want to extract all of the components (P, Q, DP, DQ, InverseQ, D).
So where I am stuck unable to do it for quite some time. this is my first time working with this encryption stuff. And not sure if I am following the right convention.
Thanks
|
|
|
|
|
With a "custom private key string", and "component extraction", and "first time working", I wouldn't trust you.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Gerry Schmitz,
Thanks for replying. I totally understand your concern. But at first I was following this link[^] and trying to understand all of the procedures.
As for my project, I would be getting a private key from the client (by adding some sort of certificate - which I don't know much about just yet, but that thing is in the future). so after getting that key I have to sign it with my SHA256withRSA string. And that's all I have to do for now.
|
|
|
|
|
|
Hi All,
I am using Microsoft azure storage account class in C# to upload a file to storage account in C#.
Does anyone know how can i share the uploaded file with multiple users through C# code.
|
|
|
|
|