|
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.)))))
|
|
|
|
|
|
Please do your own homework. There's this marvelous utility called Google that is a great source of help.
|
|
|
|
|
8 questions in the space of a few minutes, all of which can be answered by Google in a matter of seconds.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
Do NOT delete your message. It is rude!
IEnumerable and IEnumerator are two interfaces that assist with the iterator patten in .NET applications.
IEnumerable is used on an class that can be iterated over. (-able ending meaning it has the ability to perform an action). The IEnumerator is used on the class that does the work of iterating (-or ending meaning that it performs the action. i.e. It is the actor)
|
|
|
|