|
Thanks alot for ur suggestion..
but I want to make the very first letter that the user is going to enter should be Capital..
Not the one thatz already in textbox , I want to make the one which user is going to enter.
thanks
|
|
|
|
|
So you need a psychic handler?
The handler will instinctively know which letter you are ABOUT to press and set CAPS LOCK ON and then turn it off once the letter has been pressed.
Cool.
I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days
|
|
|
|
|
Surely it can know which letter you just pressed, at what position, and change that letter to a capital?
|
|
|
|
|
Thanks, but
I don't know whatz psychic handler,
and How should I configure this handler to make the very first letter to make to CAPITAL.
as I am new here,please be clear.
thanks
|
|
|
|
|
Just like Microsoft Word Automatic Grammar/Spelling check?
|
|
|
|
|
psychic handler, not perfect. but it works
<br />
textbox1.KeyDown +=new KeyEventHandler(Psychic_Handler);<br />
<br />
private void Psychic_Handler(object sender, KeyEventArgs e)<br />
{<br />
if (((TextBox)sender).Text.Length == 0)<br />
{<br />
((TextBox)sender).Text = e.KeyCode.ToString().ToUpper();<br />
e.SuppressKeyPress = true;<br />
((TextBox)sender).SelectionStart = 1; <br />
}<br />
}<br /> If it' stuck, DO NOT pull harder!
|
|
|
|
|
Hi. This would be easy way to do first char in CAPS....
char ci = Convert.ToChar(TextBox1.Text.Substring(0, 1));
TextBox1.Text = TextBox1.Text.Remove(0, 1);
TextBox1.Text = ci.ToString().ToUpper() + TextBox1.Text;
Thanks
|
|
|
|
|
|
hi
all i was asked in interview how often the garbage collector
i.e. gc.collect() will get invoked
i know why? what? about garbage collectore but
interviewer asked me will it be for every 5 minutes the method invokes
can anyone help me...
bye
|
|
|
|
|
When 1) a memory allocation request exceeds the current generation 0 segment capacity (or because of an exlicit call to GC.Collect) and 2) the object is no longer reachable.
If we exclude GC.Collect calls, this means that a GC will only occur on allocation. In other words, objects may well be ready to be released but no allocations are made, meaning no GCs will occur, so memory usage will stay flat.
*jaans
|
|
|
|
|
|
kalyan_2416 wrote: how often the garbage collector
i.e. gc.collect() will get invoked
Gc.Collect() will invoke garbage collector immediately. But AFAIK, we can't predict the timings when GC invoked when Collect() is not used. I guess it will be invoked when a cleanup is required.
|
|
|
|
|
nice quote
yup the other friend also says what u have guessed
thanx bye
|
|
|
|
|
IIRC explicitly calling GC.Collect() is generally a bad idea. The deal is that it will encourage the garbage collector to promote objects that survive collection to a higher generation. The higher generations are collected less aggressively - which has obvious performance implications.
|
|
|
|
|
You recall correctly. There aren't many occassions, (I can't think or any offhand), where you should call it - let the runtime determine this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You may consider GC.Collect() when you want to get an optimal and/or repeatable
starting condition, examples:
- application has busy and idle periods, and wants to off-load as much work as possible
from the busy to the idle periods
- application is going to be observed/measured (as in the Setup method when using NUnit),
say for performance measurements.
And yes, these are exceptional situations.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Garbage collection in .NET is not based on frequency. Instead, it is a sophisticated algorithm that will collect the object at some point after the object has become eligible for collection.
Have a read of this[^] article.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi
I am writing a UserControl that contains 20 similar 'other' controls. My basic control is also a usercontrol consisting of a Panel and a Button inside a parent Panel.
I need to create 20 of these simple usercontrols onto a bigger Usercontrol.
I have done this by using a array of this.
>> ucPanels[] iPanels = new ucPanels[20];
I call this method :
>> private void createMainPanel()
{
int z = 1;
for (int i = 0; i < 20; i++)
{
iPanels[i] = new ucPanels();
iPanels[i].Name = "myPanel" + i.ToString();
Controls.Add(iPanels[i]);
iPanels[i].Location = new System.Drawing.Point(z, 5);
iPanels[i].Click += new System.EventHandler(iPanels_Click_1);
iPanels[i].MouseDown += new System.Windows.Forms.MouseEventHandler(iPanels_MouseDown_1);
//iPanels[i].Size = new System.Drawing.Size(50,84);
z += 51;
}
}
private void iPanels_Click_1(object sender, EventArgs e)
{
for (int i = 0; i < 20; i++)
{
// I cannot reach this event
}
}
Is there anything wrong with my code as I cannot call my event iPanels_Click_1
Thanks
Amien
Amien
Cape Town
South Africa
|
|
|
|
|
If the panel is docked and filling the usercontrol you'd probably have to
add an event handler for the panels click on the usercontrol and then
call the usercontrols click event from there.
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Hi,
How can i search in all columns of a table for a word that the user types in a textbox? some code pls?
|
|
|
|
|
DataTable have a Select() method which allows you to filter DataTable and returns DataRow array.
|
|
|
|
|
Aproximately:
...
DataTable dt = ...
string sText = txtInput.Text;
foreach(datacolumn in dt.columns)
{
if( typeof(datacolumn) == string )
{
DataRow[] oRows = dt.Select(DataColumn.Name + " = " + sText);
if( oRows.Count > 0 )
{
//Do wat you have to do
}
}
}
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
I'm doing a little thing, trying to write an application to draw fractals. I've got the complex numbers down, the algorithm is working.
But, it's taking a long time, so I figured "Hey! Why not use multi-threading?"
My idea is to have a Control task which creates and fills up a Queue with Points, reports progress and spawns and controls 2 more tasks (either Threads or uses a ThreadPool), which in turn do the calculations (they take the Point they need to work on from the Queue as long as the Queue isn't empty). By using the Queue, I'm 100% that the Threads never work on the same pixel; they only work on the Queue, and lock it when they need data.
But the problem is, even though they never work on the same pixel, they work on the same Bitmap object. Which is bad, because it cannot be accessed at the same time from multiple threads (even if they want something different from it).
I can't inherit the Bitmap (sealed), I can't inherit Image (internal constructor), so any attempts at creating my own image class have failed. The one that didn't involved a simple array of Colors, but recreating a Bitmap from that at the end takes way too much time.
So I'm in the dark... I don't know if there's a trick I could use to work with that Bitmap, or perhaps a different image class I could use (that can be easily drawn on a form)... Please help.
|
|
|
|
|
Don't inherit the Bitmap, encapsulate it. Make a class that holds the Bitmap in a variable, and synchronises SetPixel calls on it.
Another alternative is to have a result queue, where the threads put their results, which the main thread then can read and put in a Bitmap. (It would have to be synchronised, of course, just like the task queue.)
It sounds like a lot of overhead to queue single pixels, though. You should consider handling blocks or lines of pixels.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Encapsulating the Bitmap doesn't help... I found that it will still throw exceptions in that case (object is in use by another thread).
But I DID solve the problem... I can create a Bitmap quickly from an array of bytes using Bitmaps LockBits and UnlockBits. I made a nice little class that I can access from multiple threads and that can quickly create a Bitmap.
SetPixel and GetPixel simply suck, as it turns out. They're too slow and cumbersome.
|
|
|
|