|
Hello
Try comparing the Text property with the Mask property
Regards
|
|
|
|
|
But when the mask property is "0000/00/00",the default text of this control is " / / /",they are not equal.
|
|
|
|
|
Hello
Two more approaches:
1- Check first character of text by IsChar() and IsDigit() methods to see if the user acually did make any input. You can also check the entire string using a forech loop.
2- Handle the TextChanged event, and store the updates in a bool called modified . Set it to true when the user makes input, and top false when the user deletes all characters.
Regards
|
|
|
|
|
Take a look at the IncludeLiterals property which will remove all formatting from the Text property, i.e. you will get the raw values entered by the user without any formatting provided by the mask property.
As of how to accomplish this, have you ever tried Google?
|
|
|
|
|
Hello
Looks like I've been a stray a bit with this one!!
The code should be like this, I think
maskedTextBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
MessageBox.Show(maskedTextBox1.Text);
Regards
|
|
|
|
|
how can change shap to mouse cursor on mouse enter textbox ???
Palestine
|
|
|
|
|
Hello
You can do that using the TextBox.Cursor property.
Regards
|
|
|
|
|
When mouse move over webpage on the screen and stop on a word that is URL,how could I catch the URL from my program?
I hope you got my meaning.Thanks
August 12,2006,Rhythm of The Rain.
|
|
|
|
|
Hello
If you can access the source of the page, this is easy using javascript, or ASP.
On the other hand -which I think is your case-, if you can't do that, then the only thing I could think of is OCR (Optical Character Recognition). Yes, I guess I've gone too far, but some trnslation programs do that. When you point the cursor to a word and press the HotKey, the recognize the characters off the screen and tranlate them -if possible of course-.
This is way, way too advanced topic. You can get an image of the link easily using Graphics class methods, but interpreting the image to text will certainly need a library.
Regards
|
|
|
|
|
Hello,
I'm wondering how it's possible to create an application wide event that's fired when any keyboard or mouse key is pressed and mouse move?
Please help. Thanks
|
|
|
|
|
Look at the KeyPress and MouseMove events in the System.Windows.Forms namespace.
Deus caritas est
|
|
|
|
|
Hi
There are usually two ways to handle user inputs (keyboard/mouse).
If you like to hanlde those events in a form you can turn its keypreview property to true and override its OnKeyDown,OnKeyUp,OnMouseDown and etc. metohds to do what you want to do (or you can add a handler using event handlers)
But if you like to handle those events in an application rather than a form you can handle messages that are being send to your application by windows.
Regards
|
|
|
|
|
If you want system-wide event notification then you'll have to have a Windows hook me thinks. There is an article on System-wide keyboard hooks here on CP, can't remember what it's called but search for "system wide hotkey" and you should find it.
As of how to accomplish this, have you ever tried Google?
|
|
|
|
|
Hi,
I am having problem refreshing the list box after I'd added an item to it.
The situation is like this, from form1, I click Add button to open a new form, let say form2 for me to fill in some details to the textbox, when I click on Add, form2 close and supposingly the list box in form1 should refresh and show the changes but it don't.
From form 1:
private void btnAdd_Click(object sender, EventArgs e)
{
form2.ShowDialog();
}
then form2 opens and it do whatever needed and pass the value using this:
form1.clientName = txtName.Text;
form1.AddToList();
then back to form1:
public void AddToList()
{
lstClientList.Items.Add(this.clientName);
}
usually if lstClientList.Items.Add(this.clientName); is done directly on the btnAdd_Click, it will add and show the changes on the list box but it don't work when I use another form to add.
Would appreciate for your help
Jie Liang
|
|
|
|
|
As you are using ShowDialog, form1 isn't doing anything until form2 closes.
Add the item after the call to ShowDialog, instead of calling a method from form2.
---
b { font-weight: normal; }
|
|
|
|
|
Hi Guffa,
Thanks for the advice, it really does work
Jie Liang
|
|
|
|
|
Hi folks!
I've just observed a behaviour I cannot understand - perhaps someone can shed some light on it...
For demonstration purpose I wrote a little program where two threads are incrementing a value, just to show someone the need for synchronization.
Everything works as expected, but then I wondered if I could measure any performance differences between using lock(this) and lock(someLockingObject) when I'm not using 2 threads running the same loop but using 4 threads with the same loop for every two of them.
When I execute the application run on my Athlon64 X2 and assign it to just one core, it's running faster than when I assign it to both cores!?
How can that be?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Probably scheduling between threads and procesors. It you modified your program to execute either loop depending on a command-line argument / button / whatever and load the two copies onto different processors then you'll probably get a faster output. But I don't know if this is what you want to accomplish.
As of how to accomplish this, have you ever tried Google?
|
|
|
|
|
Thanks, but the program isn't meant to do anything productive, it's just to show the need for synchronization.
The timing test was just a test to find out what to expect when I run my multithreading applications on a dual-core machine and I was quite surprised that the test doesn't run as fast on a dual-core as it would on a single core...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Locking a static object mite help...
|
|
|
|
|
Thanks, leppie, I'll try this.
Initially I had 2 objects for locking (non-static), one for each loop.
Then I locked both loops with the same object and then with this .
The strange thing was that using 2 objects also slowed down the program, while using a single locking object or this yielded equal (and better) results.
I'll post an update here as soon as I tried the static object for locking...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi!
The update I promised earlier:
Using a static object vs. an instance object doesn't show any difference.
Still letting the application run on both cores is slower than when limiting it to just one core...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
You are probaby not doing enough work per thread to justify multi threading it. IOW the lock construct is alot more expensive than say an increment statement.
|
|
|
|
|
Could be, yes. I'll try adding a little workload to the locked area...
Thanks,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Final update:
You were right. As soon as I let the critical section perform something more demanding the execution times with 2 cores became better than with just one core.
I was really starting to get worried, you know?
Thanks!
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|