|
Why not just use MaskedTextBox?
The code you posted has a few quarks. Why do you set e.Handled equal to e.KeyChar being a letter if it isn't a digit? And then overwrite this value two times when the length of the textbox reaches 3?
To restrict the length to 3 the handler need only contain
e.Handled = (txtKod.Text.Length == 3);
However, doing a masked input properly is a bit more work. To get it right you need to handle pasting as well as typing, accept non-alphanumerical keys like backspace, left/right arrow key, and perhaps other things.
|
|
|
|
|
I re-read your post and see you're aware of the MaskedTextBox. But apparently not of it's PromptChar property. Set it to a space if you don't want to show the underline.
|
|
|
|
|
thanks man
i will use it as u said
|
|
|
|
|
.net framework has a maskedtextbox control.
More info can be found at:
http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx
modified 27-May-14 4:58am.
|
|
|
|
|
I have a big canvas on which the image is drawn. I need to leave only the picture and cut off all unnecessary.
|
|
|
|
|
Why is your canvas so big? Why not use the size of the picture when you create the Image instance? If you don't, then the only option is to create a new insatnce the correct size and redraw the image into that, then dispose the original, big version. It would be a lot quicker (and more memory efficient) to get it right first time.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
You can create a new Bitmap and copy just the portion containing the picture to it. This is probably the simplest approach.
|
|
|
|
|
if you want crop any image, than i will suggest you to visit the link below
http://www.raiseitsolutions.com/forum/viewtopic.php?f=4&t=2
if you visit this link, you will know how to crop an image easily
thank you very much.
|
|
|
|
|
Hi,
The mapped drives of a server machine is not accessible, when i connect the server using WMI.
Please tell your suggestions, need anymore info?
My small attempt...
|
|
|
|
|
Uhhh....what? This doesn't make any sense at all.
Are you saying that you're trying to get which drives are mapped by the user logged into a particular server? In other words, are you trying to find out which shares are bein used by a user logged into a server?
|
|
|
|
|
I asked a question in the Hardware & Devices group, thought I'll throw it in here as well:
We are thinking of some Biometric integration into our app, and there seems to be some effort around standardization, does anyone have any first hand experience with an "open" API to biometrics? I would hate to have to code for each vendor etc...
(Our app will probably be a public app, so we won't know which device to target...)
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Adriaan Davel wrote: I would hate to have to code for each vendor
HA! That's what I make a living doing! I don't know anything about the biometrics field but I can speak about the facility protection market. No vendors share APIs, this forces customers to buy their hardware and software if they want to use their products. The problems start when you want to mix and match products from different vendors that all have their own command and control software. None of them communicate with each other because every company is trying to push their own software solution.
This introduces the need for integration solutions. The key to building one is to have an extremely flexible adapter layer so that new adapters can be added quickly. The goal of each adapter is to translate the data from a particular device into a common format that the rest of the application can understand so that it can remain vendor and device agnostic.
|
|
|
|
|
Hi Jimmanuel,
Thanks for the response that I was not hoping for The problem I have is that being a public website it's almost impossible to know which drivers to load as I would have to know which biometrics the person has linked...
It's starting to sound like I'm going to have to exclude biometrics...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
With a properly designed plugin architecture you could ask the user what they have plugged in and then load the proper driver.
Another possibility would be to try to connect to a device using all of the interfaces that you've developed; if they've linked to one that you support then one connection attempt will succeed and then you know what they have
|
|
|
|
|
I'm thinking of having an "Identify" button (that will loop through my know drivers etc), and a drop down to select from. Asking users is normally quite a pain as you have to give them instructions on how to figure out on all the different operating systems etc (target market is the less technically skilled public )
Thanks for the inputs
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
last night i have developed a small window application, having lot of insert and select scripts...
it runs fine for 3 times but when i run it 4th time it gives me Error "Out Of Memory Exception"
i obsvered that in my task manager Sqlserver.exe process occupies memory around 167000K .
then i killed it. and again run the code, this time it occupy 12000K memory.
again i run it...the memory increases and stops at 87125K
All It means i the C#.net objets are not disposed well.....i have tried for
GC.GetTotalMemory() but failed....???
what should i do ???
how can i release objects ??? or is there any other problem ???
thanks in advance
Rating always..... WELCOME
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Are you using the Dispose method on objects you no longer need? I found an obscure reference to a quirk I never considered on Google about Forms that are never garbage collected. It seems that a Form that is hidden will never be released by the Close method; you have to use Dispose to free the memory. It may be that this problem extends to other classes, as well.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi Roger,
if your app keeps a reference to a hidden Form, the Form stays alive, and you can use myForm.Show() to show it again. That is normal. And your app always keeps such reference, see Application.OpenForms, unless you either call Close() or Dispose() on said Form.
Here is some test code to confirm that:
public override void Test(int arg) {
using (Form f=new Form()) {
f.Text="my latest form";
f.Show();
listForms("Form shown");
f.Hide();
listForms("Form hidden");
}
GC.Collect();
listForms("Collected");
}
private void listForms(string title) {
log("List of forms: "+title);
int i=0;
foreach (Form f in Application.OpenForms) {
log(" Form "+i+" text="+f.Text);
i++;
}
log("Found "+i+" forms");
}
|
|
|
|
|
This much I knew. What surprised me, and I wish I could find the link again, was an article that explained that if Close() is called on a hidden Form, it doesn't work, nor does it emit an error. At least, not reliably. The Dispose() method does force the removal of the hidden form, so I've taken to using Dispose() whenever I'm done with a Form object. Damnation - I kept that article in an IE tab for weeks until IE finally committed a sin it didn't know how to cover up and closed itself.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Roger Wright wrote: an article that explained that if Close() is called on a hidden Form, it doesn't work, nor does it emit an error. At least, not reliably
that is new to me, but then I would probably not end up in that situation very often.
idea for workaround: if (hidden) {move offscreen; show;} close;
|
|
|
|
|
Why are you talking about how much memory SQL Server is using!?
SQL Server by design takes all the memory it can get. It loads data into memory as needed but never unloads it again unless forced to, either manually or because it runs into memory limits.
What are you trying to allocate when you get the OutOfMemoryException? Keep in mind no user can deal with a million records, so if you're doing something like fetching a huge dataset make sure to page at the database (i.e. select only a page of data, not the entire set).
|
|
|
|
|
You can manually limit the maximum amount of memory SQL is allowed to use, set it low enought to make sure you leave enough memory for the rest of your machine (Visual Studio requires a large amount of memory for example), this setting is harder on a production SQL box, leave that to a DBA, but I typically run my dev SQL instances with less than 200Mb of memory...
Is the exception you are getting a sql exception or a .Net exception? both can run out of memory and both have different ways of fixing the problem... Please give the fulle message and stacktrace...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Hi,
I'm trying to write Exchange Server 2007 interface using C#. Is there any way to access archived mails(Journal). I dont want to use WebServices so other than that is there any way?
Thanks
|
|
|
|
|
hi ...
In c# , click event and double click event is there. but in the hierarchical event call is from first call click event calls then double click event calls.
In our application we need these two scenario for example while click a button print "hi" , and while double click a button print "hello" only not in single click callback.
how can i handle these...
Thanks...
|
|
|
|
|
Hi
I had the same problem,and what I do is set a global variable(DateTime) to store the first click time,and count second click time subtrack first click time ,if the range is in your set, it will do another scope. sorce code like this
DateTime t1;
private void button1_Click(object sender, EventArgs e)
{
if (t1.ToBinary() == 0)
{
t1 = DateTime.Now;
label1.Text = "Hi";
}
else if (t1.AddMilliseconds(1000).CompareTo(DateTime.Now) > 0)
{
label1.Text = "Hello";
t1 = DateTime.MinValue;
}
else
{
t1 = DateTime.MinValue;
}
}
sorry my English is not good enough
|
|
|
|