|
Is there something like a MessageBox, that don't have MessageBoxButtons but is showing for 3-4 sec. before it closes
Thanks
Thomas
|
|
|
|
|
No.
You can probably customize a form to behave like that, though
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
You might look around and see if anyone
has done a C# SplashScreen Control.
I'm new to C# but in Delphi the usual
scheme for a roll-your-own splash
screen is just to dynamically create
a Panel with a bunch of labels to
display your text.
Then use a timer to destroy it after
so many seconds.
|
|
|
|
|
Do you know what is faster? Use CodeCompiler.CompileAssemblyFromDom or CompileAssemblyFromCode ?
Thanx
Wizard_01
|
|
|
|
|
I don't have a specific answer, but...
The DOM doesn't support all the different syntax constructs (there are some interesting blog entries about this if you search Google), and setting up the DOM is a royal PITA--if you have source code, why set up all the DOM classes? In fact, I've found it easier to generate source code than work with the DOM. So, I think you have to take into account the overall performance issue.
Marc
Microsoft MVP, Visual C#
MyXaml
MyXaml Blog
|
|
|
|
|
I am making a custom Textbox control. What I did is I put a windows textbox under a usercontrol, so may base class is windows usercontrol. What I want is the event and properties of windows textbox which is under the usercontrol to show up as my base properties and events because what is happening is when I use my custom control the usercontrol properties and events are showing up so i cant access the event of my textbox and set properties on it. And is it also possible to hide the events and properties of usercontrol and instead the properties and event of textbox will show up when using this custom control?
Thank you very much.
|
|
|
|
|
Why do you want to put this into an UserControl?
It would be much easier to simply extend the TextBox class.
|
|
|
|
|
I did this because I like to create a custom control that is all-in-one, meaning I will be adding my custom dropdown box, add a date dropdown, add some buttons to it and anything that I can think of. My problem is if I compile my control then use it on VB.NET environment I can't access the event of my textbox becuase all event that is showing are usercontrol event(unless I make my own custom event which render the usercontrol event useless but still showing in my control's event). So what I want is when I run my VB project using my custom control then I press a key on my custom control what I want is the keypress event of the control to fire up. So is there any way to expose the events of the textbox instead of the event of the user control without making custom event just to send all the events of the textbox to the user? And is there anyway to hide some events in the usercontrol?
Thanks.
|
|
|
|
|
Yeah, I thought you do something like this. Just wanted to be sure
To expose events of your TextBox without making custom events, you could subscribe your Control to the TextBox events and inside the event handler raise the appropiate event of your Control. If you want to expose some specific TextBox events you will have to declare custom events.
<br />
class Custom : UserControl<br />
{<br />
TextBox textBox1;<br />
<br />
public Custom()<br />
{<br />
textBox1 = new TextBox();<br />
textBox.TextChanged += new System.EventHandler(Custom_TextChanged);<br />
}<br />
<br />
void Custom_TextChanged(object sender, System.EventArgs e)<br />
{<br />
this.OnTextChanged(EventArgs.Empty);<br />
}<br />
}<br />
To hide some events of your UserControl you have the redeclare them with a stricter access modifier like private or protected.
<br />
private new event System.EventHandler SizeChanged;<br />
Hope this helps!
|
|
|
|
|
Thanks Stefan you've been a great help. Now I can continue coding my controls.
|
|
|
|
|
My pleasure!
|
|
|
|
|
Stefan has a point, but if you're building a composite control, then you either need to add events to the UserControl , which would handle the events of the TextBox . The handlers for the various TextBox events fire the events on the UserControl (either overriding existing events like TextChanged or making new events like TextBoxTextchanged ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
How to use a textbox control along with a calender control in asp.net codebehind is C#.
onclick of the calender's particular date the day/month/year should be put in the 3 textbox respectively?.
How to code for this. On server side or client side.
because i want that dates comparison also.
thanks in advance
|
|
|
|
|
hi,
Let me first clarify what I have understood from your requirement...
You have a calender control on the web page and 3 textboxes.
When the user selects a date the day month and year component should get displayed in the 3 text boxes...
If this is so... then herez the code...
private void CalMain_SelectionChanged(object sender, System.EventArgs e)
{
DateTime selDate = ((Calendar)sender).SelectedDate;
txt1.Text = selDate.Day.ToString();
txt2.Text = selDate.Month.ToString();
txt3.Text = selDate.Year.ToString();
}
Note : This code is server side.
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Hello Aryadip
Thanks! that code is working & comparitively it's so simple.
|
|
|
|
|
Hello, could anyone share info on how to reduce the memory usage of a .NET windows application. I noticed that my application that was written in C# consumes 10 mb of page files which I think it is kind a bloaty.
Any areas which need to be targeted for optimization for .NET application?
thank you.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
I'm not sure if you've already done this, but there's an option to "Optomize code" in C# Apps. You can find it in Project Properties -> Build Options
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
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
|
|
|
|