|
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
|
|
|
|
|
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[^]
|
|
|
|