c# calling value from another page - c#

Working on a windows 8 store app, so I've managed to pass a parameter to another page, but how do I call it on the other page?
private void Button1_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(Test), Testbutton);
}
As you can see Testbutton is what I am passing, so on another page I want to call it, then on a button click I will disable the button. The disable button part I know how to do.

Related

Pass "enter" from text box to another text box

I want to create 2 simple textbox in aspx file and .cs, whenever I click a button, it will pass the value to another textbox. as simple as this:
private void Click(object sender, EventArgs e)
{
textbox1.text=textbox2.text;
}
However, the "enter" message doesn't pass to another textbox. please view the example below
do you have any idea how to do it?
You will need to do that in the button's click event, say you have a button called transfer, then create a click event called
private void Transfer_OnClick(......)
{
textbox1.text=textbox2.text;
}
That should be all you need, this is assuming you are using ASP.NET Webforms.

How to add an event on a menu in C# project?

I have a C# Windows Forms App that contain a menu bar.
I want to display a Help Message when I press on the "HELP" menu button.
All that I can see when I press view code is this:
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
}
I think that I need to create inside the function a MessageBox or an event that will display the desired message.
Do you have any idea how should I do this, please?
Below should work for what your asking. If you are on your form you can double click the button you want to interact with, and Visual Studio should take you to the empty method.
private void helpToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("This is supposed to be helpful");
}

ASP.NET Change the current webform

I am working at a problem in ASP.NET.
I have to create 2 windows (i think that I need to make web forms, i don't know why they said windows) one is the login form, when i press ok and the username and password is ok, I need to
show my second window (webform)
How can I do that?
I tried to do
protected void Button1_Click(object sender, EventArgs e)
{
Form2 form = new Form2();
form.SetFocus("id");
}
But it gives me error
A form tag with runat=server must exist on the Page to use SetFocus() or the Focus property.
What should I do?
Am i right, I have to do separate webforms for thoose windows?
This is the picture from the problem that they provided
If you use webforms you can just use the following code to redirect to second form:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Webform2.aspx");
}

Detect whether user has clicked on a specific link inside a Browser Control?

I'm not using the in-built browser control (ie wrapper) but i'm using Webkit.Net instead
When i click on button1, the WebkitBrowser will navigate to the link typed on textBox1
private void Button1_Click(object sender, EventArgs e)
{
backgroundWorker1.Navigate("https://www.facebook.com/cocacola");
}
Can i detect when user click on the Like button ? For example when the user likes the page, a MessageBox appears and says that the page has been successfully liked !
Anyhelp would be highly appreciated

How do you PerformClick(); for a button on a different tab?

I'm using Visual c# express 2010, I have 3 tabs and on the first tab there is a button that exits the program. I'm trying to call that button click on the 2nd and 3rd tab with
btnExit.PerformClick();
but since it isn't visible nothing happens. How would I call the invisible button click?
any help would be appreciated
EDIT:
Thanks for the replies, the two answers work great but I found a way that I think is easier and better.
instead of systematically changing tabs or calling a whole different method, I did this
btnExit_Click(sender, e);
I can put that in any other button click and it works great, very simple to.
I think it's better to create a method that actually has the code to exit the program, and call that method from btnExit click event and also other buttons click event, than PerformClick of the exit button.
void ExitApplication()
{
// code to exit the application
}
protected void btnExit_Click(object sender, EventArgs e)
{
ExitApplication();
}
protected void ButtonInOtherTab_Click(object sender, EventArgs e)
{
ExitApplication();
}
This way it's easier to read and understand.
myTabs.SelectedTab = specificTab;
btnExit.PerformClick();

Categories

Resources