|
Roland Bär wrote:
if you have the 20 textboxes, that should be tested, and then also other textboxes in the same form, that should not be checked, it is better to have the 20 textboxes in an own collection. Like this you can iterate over your collection without checking if it is a textbox to be checked or not.
There are other ways around your problem, however my answer still identifies how to accomplish what he was asking for.
-Nick Parker
|
|
|
|
|
Nick Parker wrote:
Because then he would have to maintain that collection where as the Form already maintains a collection of all controls applied to it
hmm.. yes, I see what you mean.
...speaking of which, let me ask this:
If I picked the TextBox object that gets added to the Form's Controls collection (say it is named tBox1), and simply add it to my own collection (say an Hashtable) like so:
myTable.Add(myTable.Count, tBox1);
Wouldn't I be adding just a reference?
Thus the impact on the memory would be relatively small?
Or am I missing something here?
|
|
|
|
|
There are many ways in which you can tackle this, depending on the exact circumstances you should consider using a specific method. My method is rather abstract.
-Nick Parker
|
|
|
|
|
this won't work - t is TextBox, t would still be a Control which does not have a .Text field so use "as".
also why are you casting this.Controls? its a ControlCollection already...
foreach(Control t in this.Controls)<br />
{<br />
TextBox tb = t as TextBox;<br />
<br />
if(tb != null && tb.Text == String.Empty)<br />
{<br />
break;<br />
}<br />
}
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Philip Fitzsimons wrote:
this won't work
Yes, it will, try it.
Philip Fitzsimons wrote:
also why are you casting this.Controls? its a ControlCollection already...
Test your code, it will fail if you don't cast it, mine did, I previously wasn't casting it.
-Nick Parker
|
|
|
|
|
I can't see who it would work - it won't work on my computer...
"t" is a Control.
"t.Text" is not valid on a Control.
how does it compile?
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Philip Fitzsimons wrote:
how does it compile?
Drop my code onto a form, it works.
-Nick Parker
|
|
|
|
|
no it does not:
error CS0117: 'System.Web.UI.Control' does not contain a definition for 'Text'
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Philip Fitzsimons wrote:
no it does not:
Ah, I see you are doing this on an ASP.NET webform. This works on a Windows Form.
-Nick Parker
|
|
|
|
|
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hi all, this is kind of an architecture question:
I'm in the initial stages of designing a commercial app that is ported from c++ to c# (rebuilt actually) and want to use business objects that can be used both remotely and locally (the old app was local only, this is a new thing). (I.E. a user may install in network server mode or single computer mode)
I'm very new to remoting, just getting my feet wet and am wondering in this situation how to go about this.
I don't want to duplicate any code if possible.
How would you suggest creating a business object that can both be remote or local without having to change the source code for the objects themselves?
(Possibly not inherit from MarshalByRefObject in the case of being local but do inherit from MarshalByRefObject in the case of being remote?)
------------
Tomorrow is the same day as today was yesterday.
|
|
|
|
|
Hi,
You should take a look at VB.NET Business Objects by Rocky Lhotka. (Yes, it's VB.NET, who cares, it's easy enough to convert to C#!)
All the info you need is there, plus you get the CSLA.NET framework for free! It has even been translated into C#...
Very good book! You'll love it!
|
|
|
|
|
Looks ideal, thanks!
Now if I hadn't just blown my book budget on those UML books...
------------
Tomorrow is the same day as today was yesterday.
|
|
|
|
|
Inheriting from MarshalByRefObject doesn't hurt anything if you're not using remoting. Heck, almost everything in the Windows Forms does! (those that inherit from Control , which inherits from Component , that inherits from MarshalByRefObject ). It that way with any OO design and inheritance - only use what you want to. It's field values that take up space in memory - not a gazillion methods and properties. And such methods and properties won't do anything unless they're called. Heck, most of those controls aren't even remoting because they're not serializable (although you could either implement an ISerializationSurrogate for them, or extend them and mark your control as [Serializable] ).
The best place to put such an object is in an assembly that both the client and server share, such as the one where the remoting interface is (assuming you're doing it that way, and you might as well since you are using a shared assembly now - it makes for easier maintainence rather than generating a new one using soapsuds.exe or something when you change your remoting object).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hello ,
Hello i design one software for graphics systems.
It consists of more graphical calculations like AutoCAD.
Which language i should use for that?
C++ with MFC or C# ?
I know Java will be the
worst for this kind of applications.
Can i expect performance of C# equal to C++ in my case?
"They can because they think they can" - Voltaire
|
|
|
|
|
|
Quake.NET is written with native code, not C# code;
RSS feed
|
|
|
|
|
For something like CAD, you would be using a graphics technology like OpenGL or DirectX to do the heavy work, so there wouldn't be much need to worry about what language it was written in.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Actuall Java3D is based on DirectX so it doesnt really matter. Obviously it would be the easiest with MFC so You designate a view, but you can do it in C# and use the frameowrk classes. But you wont get the speed and since its cad its not that intensive so either shouldnt matter
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Should we wait for a C# with some better performance?
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
its more of a fact that your running managed code instead of c++ so the performance is still good. For cad drawings thats not rotating 3d rasterized images you wont even notice the speed difference.
I develop games in direct3d so I see it right away
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
kumaru_san wrote:
Which language i should use for that?
C++ with MFC or C# ?
Why would you want .NET?
For anything related to graphics and speed I personally would use C++ and maybe MFC. If I had a need for the .NET frameworks I would probably use MC++. Speed and C# (or VB.NET) does not go hand in hand. The speed is fine for business applications or data driven applications but graphic driven apps need a core C++ at this time.
Rocky Moore <><
|
|
|
|
|
C# is a managed language.
It means and seems that we should never wait for a c# with some better performance. Do you agree?
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
Startup times will get faster, but probably not a lot faster. Also, some BCL classes are slower than their C++ counterparts (but then, some BCL classes are faster than the C++ ones).
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
hello
my question is do .NET base class library functions
been written from scratch or do they call the underlying
Win32 API ?
Are Win32 API (classic) and .NET library two
entire different entities?
Kumar.
"They can because they think they can" - Voltaire
|
|
|
|