|
hdv212 wrote: how to solve my problem ?
If the text is already an arabic number, then don't set the text.
protected override void OnTextChanged(EventArgs e)
{
string arabicNumber = ToArabicNumber(Text);
if (Text != arabicNumber)
Text = arabicNumber;
}
|
|
|
|
|
thanks for reply
but my problem is that when i change TextBox.Text in onChangedText, the onChangedText event fire again and so on (Unlimited loop), like this :
TextBox.Text(onChangedText fired) -> ChangeToArabic(onChangedText fired)
-> ChangeToArabic(onChangedText fired) -> ChangeToArabic(onChangedText fired) -> ChangeToArabic(onChangedText fired)-> ...
how to solve this problem ?
|
|
|
|
|
hdv212 wrote: thanks for reply
but my problem is that when i change TextBox.Text in onChangedText, the onChangedText event fire again and so on (Unlimited loop)
Are you suggesting that I gave you a solution that loops infinitely? If you can show where my solution loops infinitely then I'll accept that you still have a problem. If not, then what is your problem?
Please look at my solution. It is very simple. It does loop but once. The reason it only loops once is that I have a condition that stops it looping more than that.
So, my question to you: Did you try my solution before complaining that I don't solve it? Looking at the way you phrased your follow up post, you are basically saying I did not understand your original problem, which implies that you didn't attempt to implement my solution. This suggest that IN FACT you did not understand my solution, rather than me not understand your problem.
|
|
|
|
|
thanks Colin Angus Mackay
i tested your suggestion way, but it is not help me, because when i add new character in my textBox(and fire OnTextChanged event) my new text different with old text that i converted to arabic numbers.
|
|
|
|
|
hdv212 wrote: i tested your suggestion way, but it is not help me
Bit it no longer loops infinitely. Right?
hdv212 wrote: because when i add new character in my textBox(and fire OnTextChanged event) my new text different with old text that i converted to arabic numbers.
Then you need to capture the selection before changing the text, then put the selection back afterwards. In a text box a selection can have zero length which representst the position the cursor is at.
|
|
|
|
|
Hi,
Here iam using windows applicatio,and i have one timer control,here i need to give timercontrol interval value in Config File.
How can i do this?
Vasvai
|
|
|
|
|
Well, you get yourself a StreamReader, pass the path to your config file and start reading.
Say you had your config file setup like this:
name="bob"
interval=20
age=86
You could use something like:
StreamReader SR = new StreamReader("myConfigFile");
do {
string[] line = SR.ReadLine().Split('=');
string variable = line[0];
string value = line[1];
switch(variable) {
case "interval":
myTimer.Interval = Convert.ToInt32(value);
break;
}
if(SR.Position == SR.Length)
break;
}while (true);
Just to give you an idea.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
hi there,
i want that my application should run once at a time, like some softwares/programs (for example : windows default picture viewer)
so to i do that i did it like this :(in Main())
string name = Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf(@"\") + 1).ToLower().Replace(".exe","");
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(name);
if (p.Length != 0)
{
Application.Exit();
return;
}
but i dont like this way, anyone know any other good way?
thanks
Becoming Programmer...
|
|
|
|
|
i dunno what happened but "edit and delete" buttons arent showing in the post,
so here is the original post that not appearing correct (above) :
hi there,
i want that my application should run once at a time, like some softwares/programs (for example : windows default picture viewer)
so to do that i did it like this in Main())
string name = Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf(@"\") + 1).ToLower().Replace(".exe","");
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(name);
if (p.Length != 0)
{
Application.Exit();
return;
}
but i dont like this way, anyone know any other good way?
thanks
Becoming Programmer...
|
|
|
|
|
|
my way is short than it, xD
Becoming Programmer...
|
|
|
|
|
So what? Shorter doesn't mean better. What if your executable is renamed? Your code won't work.
|
|
|
|
|
yeah i know, thats why i asked here... so i'll use mutex because it will work when application renamed.
thanks
Becoming Programmer...
|
|
|
|
|
You are welcome
|
|
|
|
|
Your code may be shorter, but it certainly isn't better. The right way to do this is using a mutex which you can guarantee will be unique to your application and doesn't depend on the process name. There are also solutions other than the one presented in the article, but they all work basically the same way. Search for the words "c# single instance application" and you should find a lot more examples.
|
|
|
|
|
That's correct, a Mutex is probably the most simple and correct way to ensure a single instance.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi All
i am trying to override the PreProcessMessage for the form
and i am using this code
public override bool PreProcessMessage(ref Message msg)
{
switch (msg.Msg)
{
case WM_RBUTTONDOWN: return true;
default: return base.PreProcessMessage(ref msg);
}
}
but this code never been called
i am wondering, why ?
|
|
|
|
|
Do you call the code yourself? If not then i can't see you being able to get the return value from it. Are you sure you don't mean to override WndProc?
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
This method should be called by the by the framework, and i dont want to override the WndProc
|
|
|
|
|
is there any one can help ?
|
|
|
|
|
hi all
who i can Do Ildasm.exe and where ican do that
Thaer
|
|
|
|
|
I don't really understand the question, but you can find ildasm under (when you have the .NET SDK installed)
Start Menu -> Program Files -> Microsoft .NET Framework SDK (1.1/2.0) -> Tools -> MSIL Disassembler
Alternatively, a better program is .NET Reflector[^]
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello All :
I`d like to add a wav file to my project but I want when I press a buttom the wav file is begin to turn on , if there is a (if) statment the other file is on , if there is a (list box) every time I enter a new element it`s also other wav file is on ........
<<<<<<<<<<<<THANKS A LOT>>>>>>>>>>>
|
|
|
|
|
Not quite following you here.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Sorry what do you mean by
((((Not quite following you here.)))))
|
|
|
|