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

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);

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

I have trouble sending text to another program, please help me [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 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.

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 prevent MessageBox on Exception in C#? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm trying to make a C# (Windows Forms) application which utilizes SQLite. Anyway, my code is this :
try
{
db.Insert("COLUMN_NAME", data);
}
catch (Exception e)
{
//MessageBox.Show(e.Message);
}
I made COLUMN_NAME unique, so it throws an SQL error, intentionally. But I don't want to see the error message in a MessageBox, so I commented out the MessageBox.Show() line, but still the error message pops up. Is it a property of try / catch ? If so, how can I prevent it ?
P.S.
I know there are better ways to do this task, but it is not important. I just want to learn how to get rid of error messages in exceptions.
Thanks for any help !
I figured the problem. The line db.Insert(); itself has a try/catch block, which shows a MessageBox.
I found the code here by the way.
Thanks again for all the help !
There is RunTime error in your line at
db.Insert("COLUMN_NAME", data);
So you need to fix this.
Try by clean and then build your code. Then run the code. Sometimes dll file is not refreshed. It will be regeneratedby clean and build your code.

How do GroupBox's and RadioButton's work together? [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
Could anyone explain me how the compiler knows to perform appropriate method when we select RadioButtons in this example ?
It's hard to say for sure what you're asking. I think you're asking how the system knows that it should execute the iconType_CheckChanged method when one of the icon radio buttons is clicked, and how it knows that, for example, the asteriskRadioButton changed.
The answer is in two parts. First, in creating the program in Windows Forms, you hooked up the CheckChanged event handler for each of the radio buttons. So the asteriskRadioButton CheckChanged method contains the value iconType_CheckChanged. That information is added to the partial class that you don't usually see. It's in your Form.Designer.cs file in the InitializeComponent method. It looks something like:
this.asteriskRadioButton.CheckChanged += iconType_CheckChanged
You don't typically see the Form.Designer.cs file. To view it, expand the form node in the Visual Studio Solution Explorer and you'll see the file listed:
The second part of the answer is that when you click the radio button (or when some code changes the state of the radio button), the underlying control machinery calls iconType_CheckChanged, passing a reference to the control that triggered the event in the Sender argument.

Categories