I have trouble sending text to another program, please help me [closed] - c#

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 11 months ago.
This post was edited and submitted for review 11 months ago and failed to reopen the post:
Needs details or clarity Add details and clarify the problem by editing this post.
Improve this question
I am sending some keys and text to a website in Firefox with this code:
IntPtr calcWindow = FindWindow(null, "website - Mozilla Firefox");
if (SetForegroundWindow(calcWindow))
{
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("hello world");
}
Now the problem is that it is sent too many times. For example, the text "hello word" that he sends in the text box is sent about 60, 70 times. I want each key or text to be sent only once. Thank you for your help.
I made a correction to the code but I did not get any results.

After guiding the esteemed users, I realized that the problem is in the ring counter numbers, and after changing the condition and the for loop counter, I reached the appropriate result and the problem was solved.
The counter part in the for loop can increase or decrease the value of the variable. The for loop executes a block of code repeatedly.

Related

Saving search value in Autocomplete [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 days ago.
Improve this question
how are you? I need to implement an autocomplete with a search on an entity to save it in a list of objects, all this with a previous confirmation message. After saving the item, I can't select the last line of the previously entered value. Any idea? I leave the step-by-step to try in TryMudBlazor.
TryMudBlazor Link
Search for "hey" and press enter
Confirm the message box
Select the string value (it is not possible to avoid the entire selection)
I need to save the last search value so I can continue searching for a similar item

C# WPF Constantly Update label from thread [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I've been trying to do one last thing for an app I've been developing to help me learn c# and I don't get why its not working the number wont update after one try its very annoying and help help would be appreciated thank you :)
int num = 1;
Dispatcher.Invoke(new Action(() => Connectorbutton.Content = num += 1));
Thread.Sleep(2000);
the button is writing too only goes up one number even while its looped. I imagine its not updating the text but is in the background because I've tried to update it on the mainthread and it still wont update like I need it too. LMK if you have any ideas thank you for your time!
Do like this. Your caller block your thread.
Result

how to call an integer which is changing every time loop runs? see image linked below [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
[how to call an integer as it is changing when loop is running i want print and calculate every single time loop runs hope you understand my question
You need to change the line
total = perunit * quanitity
to
total += perunit * quantity
this will add the result to total, not override total every time.

How to check if a string is matching a sub-string in another string [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a file contains a lot of C functions' declarations.
For example,
void Add (int a, int b);
void AddWithCarry (int a, int b);
And I am requesting the user to enter the name of the function he wants to delete and then the whole line should be deleted.
I have done the following psuedo code:
Check if line.Contains(string)
If yes, delete the whole line.
If not, check the other line.
It worked fine if the user requests to delete AddWithCarry function, but if the user requests to delete the Add function, both lines will be deleted as both of them contains the Add string.
How could I overcome this problem ?
Replace your if with:
if(line.Replace(" ", string.Empty).Contains(string + "("))
Not the prettiest way, but should work, as long as function calls are in format of : funcName();

Programatically Shows a Pop Yes No Pop up inside a code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Good Day Every one,
Can you help me produce a code to produce pop up window like return confirm? the thing is it should be inside a method not after a click.
if (a == "1")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "messagebox", "<script>$(document).ready( function() { csscody.confirm('<br/><h1> Confirmation</h1><br/> We have currently existing Details for that Upload Proceed?<br/>',{onComplete: function(e){if(e){process();__doPostBack('ctl00$ContentPlaceHolder1$btnCommitSaving','');}}});return false;});</script>", false);
//ClientScript.RegisterStartupScript(typeof(string), "messagebox", "<script language='javascript'>alert('Continue Uploading?.');</script>");
// here a pop up message should appear if he press yes he will do the procedure if no the program will cancel the procedure
// the other one is just an alert with OK button not having Yes or no
}
i tried the code with // but its not working it just passes by it in debug mode.
im sorry but i have a very minimal understanding about javascripts. so please help me any reading materials for my future reference would be ideal but a code with explanation would be better Thank you so much!
**Edit
Honestly Speaking i really do not know why it is not working in debug mode it just passes in that statement without any pop up box that appears, im really sorry if i do not know about javascripts that's why im asking help to enlighten me, also to find a way around about this problem.
ClientScript.RegisterStartupScript
you should only do it on if you want to add the script on page first load and not after you postback and you can use javascript confirm
Page.ClientScript.RegisterStartupScript(this.GetType(),
"ButtonClickScript", "confirm('Please select date within the same month and year')", true);

Categories