|
yes, it has been done cause I am building it in release mode.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Then sorry...can't really help you.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
It is okay. thanks.
I notice that you are from Malaysia too. Which part of Malaysia are you in?
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
KL, you?
Did you update your bio. I've seen your bio before, but it said you were from the states.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Really? May be there was a technical glitch in Codeproject.
I am in Puchong, Selangor.
Malaysia Boleh (sound stupid)
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
By the way, could anyone answer my question? thanks.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
There is no way to reduce that footprint and your app really isn't using that much memory. If you look at the working set for the app, you'll see that it is considerably smaller than what you see allocated in TaskManager. It is page space that is, call it reserved, for your app, but not in use. This space can be freed at any time and used for other processes by the Garbage Collector and/or the page manager in Windows.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You should definitely read the newest Patterns and Practices book, Improving .NET Application Performance and Scalability[^]. It's good for any newbie, intermediate, or advanced developer.
Specifically for what I wanted to mention, you should take a look at Finalize and Dispose Explained[^] and the following 2 or 3 sections in Chapter 5 of that book.
Disposing objects is a big advantage. Since almost all Windows Forms controls (and many other classes in the .NET FCL) encapsulate native functions and resources - called unmanaged resources because they're not managed by the runtime Garbage Collector (GC) - they need to be disposed. The controls in Windows Forms will take care of this for you since they follow the common pattern, but disposing them when you're done will improve performance since the object is freed and the GC won't need to collect it later.
This is especially important if you use Form.ShowDialog . If you read the documentation for ShowDialog , you'll see that it says you must dispose it. This has something to do, IIRC, with the message pump created to handle the dialog (though this isn't necessary for Show ). A good way to make sure this - and other objects - are disposed - even in case of error - is to use the using statement like so:
using (MyForm form = new MyForm())
form.ShowDialog(); Boxing and unboxing is also a big hit on performance. Value types - like the primatives, enums, and structs - are allocated on the stack. When you treat them as an Object , they are boxed. When you cast that Object back to a value type, it is unboxed. This is very detrimental. For now, all you can do is suffer or rewrite many of the common classes like ArrayList that many use to store value types. With .NET 2.0, C# (and other languages) are gaining support for generics (templates in C/C++). This will greatly improve performance since a value type would be stored and accessed as a value type with boxing and unboxing.
The Patterns and Practices book has a lot more information I'm sure you'll find useful.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Wow, thanks for the explanation.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
i build a C/S based TCP connection.
Server send to Client data 20 times in a loop like this:
for(i=0;i<20;i++)
SocketServer.Send(data);
while Client receive data from Server 20 times in a loop :
for(i=0;i<20;i++)
SocketClient.Receive(data);
for some reason, at the 10th step, Client has an error and couldnt receive lots of data behind.
In TCP connection, the data after 10th step will be stored in System Chache. But i dont need them further. How to discard them and Empty System Chache?
|
|
|
|
|
Is there a way to access a variable thats on a different form. Actually I need to access a dataset and dataTable, etc thats on Form1 from Form2. Is there a way to do this, other then making them public?
|
|
|
|
|
|
go for internal insted of public
|
|
|
|
|
|
#if _MSC_VER >= 1300 //Check for VC7 (this is for VC)
<modified>
for C#
use
Environment.Version.ToString()
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Hmmm...Come to think of it, I don't remember seeing ANY predefined preprocessor constants. It looks like you'll have to define your own and manually set it.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Come to think of it, I remember seeing ANY predefined preprocessor constants. It looks like you'll have to define your own and manually set it.
Yeah, that's what I thought. Sometimes it amazes me how useful things like this are completely missing from the VS-C#-.NET hodgepodge of features.
Marc
Microsoft MVP, Visual C#
MyXaml
MyXaml Blog
|
|
|
|
|
IIRC, I saw some blog about a compiler version (perhaps a few other things) being added to the C# 2.0 compiler. Here's to hoping:
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm having trouble with tooltips in winforms. I'm designing a control, and I need it to show tooltips when the user hovers within certain rectangles within it, and also popup with a rolling indication of a value as the user drags part of this control.
System.Windows.Forms.ToolTip seems a little lean on features to provide this type of functionality. If necessary I'll just hook back into Win32, but of course this defeats the very purpose of .Net. Any suggestions anyone?
Joel Holdsworth
Wanna give me a job over the summer?
View my online CV and Job Application[^]
|
|
|
|
|
There are quite a few good articles on tool tip components here on CodeProject, including balloon tips. I recommend searching for a couple of those.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Oh, as far as actually utilizing tooltip messages, see ToolTip Controls[^] in the Platform SDK. It is this messages you need to send and handle in your custom Control that describe how a tooltip should be displayed. This is for standard behavior, of course.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Basically,
What I did was making a Typed DataSet called "MessageDataSet" in visual studio .NET 2003
When I want to add the dataset to my webform, I get the following error message.
"Could not add an instance of DS412.MessageDataSet to the designer.
To resolve this problem, build the project, fix any errors, and add the instance to the designer again."
Problem is when I build my project, I don't get errors. It seems to be a typical problem on my computer, coz a friend of mine ran my project on his pc and no errors were given.
Allready reinstalled visual studio, but problem persists. Allready made new project and a comparable exercise, and still the same error...
I'm really desperate...
What can be the problem ? Has it something to do with my settings of visual studio ?
Thanx in advance far any give suggestion
|
|
|
|
|
Is it possible to write the html rendered by the datagrid control to a StreamWriter? I would like to write all the html formatting and data out to a static html file.
Thanks,
Jason W.
|
|
|
|
|
The rendering methods for the DataGrid web control (as well as all other web controls) use an HtmlTextWriter . You could extend that class and provide your own that could optionally write to a file in addition to the response stream. This forces you to call the render methods in ASP.NET, however, so you'll probably want to define an IHttpHandler and associate that with a different extension Type that does what the PageHandlerFactory (for .aspx files) would normally do.
MSDN had a recent write-up on .Text (a .NET blogger) that may help. Read Serve Dynamic Content with HTTP Handlers[^] for more information.
Another option is to define a handler (like above) or an .ashx file (by default, a simple handler that must implement IHttpHandler ) that grabs the data for a DataGrid and calls RenderControl to an HtmlTextWriter created using the response stream. Then just save this file to disk. This wouldn't have any other page data - just the DataGrid output.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I need a little help here.
I am writing a winforms control in c#. This control is a non-static control that needs to have a client edge. So I started looking around for a suitable class to derrive the class from. I came up with two options...
1. System.Windows.Forms.Control
The control I'm writing is rather non-standard, and doesn't really resemble any standard controls at all. So i figured that it would be best to derrive from the Control base to make for a nice uncluttered start point. However there's a problem! I need a client edge. I could draw this with the ControlPaint.DrawBorder3D, but the client edge would remain outside this line! I have no way of knowing how much padding the DrawBorder3D adds. I could probably do it by working back into the old Win32 api, but that really defeats the whole purpose of me writing in .net!
2. System.Windows.Forms.Panel
...A second option which has served me well up till this point. Admittedly it has a lot of functionality for things like scrolling which I don't need, but overall it works well. It solves my problem of client borders - it does them automatically! It even provides a BorderStyle property which I _really_ like. It also provides setting for background colors or even background pictures! There's just one problem: System.Windows.Forms.Panel seems to eat keyboard messages before I get to look at them. I overide OnKeyDown, but I just don't recieve any messages!
Can someone tell me there's a way for Panel derrived control to recieve keyboard messages? Or failing that if there's a good way of providing a selection of client borders, and working out their padding, or alternativly if there's another base class that would be better suited to this kind of control?
Joel Holdsworth
Wanna give me a job over the summer?
View my online CV and Job Application[^]
|
|
|
|