Trying to use the "launch url on c#" but doesnt work - c#

read title
Here is the code i'm using
System.Diagnostics.Process.Start("My url, dont wanna show it xd");
But visual studio tells this
screenshot
i tried using the light, but tells
this

You need to add a method to the click event before you can call the Process.Start. For instance:
button14.Click += Button14_Click;
Now if you click the button it will open the browser.
private void Button14_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("my url");
}

Have you tried
Process.Start("chrome.exe", "http://www.YourUrl.com");
Similar question here: How to launch a Google Chrome Tab with specific URL using C#

Related

Action when website changes

how can i make action when link in WebBrowser1 changes?
I tried to do if(webbrowser1 == https://www.google.nl/intl/en/about/)but it doesn't work
I mean at startup in WebBrower1 is http://www.google.com and when i click something in this WebBrowser1 link changes, for example https://www.google.nl/intl/en/about/ and my question is, how can make an action (MessageBox.Show("you are here"); when i'm on main google page and i'm go to about page
This is "Windows Forms Application"
I guess you could do it using Navigated event.
You can also find an example and how to catch and redirection moment here: https://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.navigated(v=vs.110).aspx
I believe this example will help you:
// Shows ModalWindow upon navigation.
private void webBrowser1_Navigated(object sender,
WebBrowserNavigatedEventArgs e)
{
MessageBox.Show("you are here:" + WebBrowserNavigatedEventArgs.Url);
}

Open Links In Another TabPage WebControl

I have a tabControl with two tabPages each with their own Awesomium WebConrol. I need links from one WebControl to open in the other WebControl. I'm currently using VS 2012.
How would that work? Is it even possible to do?
You need to add target="_blank" to your links. This way you will be able to capture webControl.ShowCreatedWebView event. In this event you will have target link e.TargetURL. You can load it to another webControl object, like in initialisation.
Your link:
Link
Your code (webControl1 in first tab, this.webControl2 in second):
this.webControl1.ShowCreatedWebView += this.webControl1_ShowCreatedWebView;
private void webControl1_ShowCreatedWebView(object sender, Awesomium.Core.ShowCreatedWebViewEventArgs e)
{
webControl2.Source = e.TargetURL;
}

Navigation error

I have a hyperlink button in my Silverlight 4 application. I want to download an apk file when I click on this link. I am able to download file but my problem is that when I click on link it downloads the file and trie to navigate on that link so it shows the dialog for file download and raises an exception.
and the code behind hyperlink button is
private void hyperlinkButton1_Click(object sender, RoutedEventArgs e)
{
Uri myAbsoluteUri = new Uri(Application.Current.Host.Source,"../download/ItimHRMSAndroidApp.apk");
HtmlPage.Window.Navigate(myAbsoluteUri);
}
I just want to open the download link - not actually navigating to that page.
Set the URI within the markup:
<HyperlinkButton x:Name="MyButton" TargetName="_blank" Content="Download APK" NavigateUri="/download/ItimHRMSAndroidApp.apk" Canvas.Top="40" Canvas.Left="30"></HyperlinkButton>
And remove the Click event handler:
private void hyperlinkButton1_Click(object sender, RoutedEventArgs e)
{
Uri myAbsoluteUri = new Uri(Application.Current.Host.Source,"../download/ItimHRMSAndroidApp.apk");
HtmlPage.Window.Navigate(myAbsoluteUri);
}
Why not try using a Generic Web handler
And return the apk file
Like this post
Hope this helps.
the problem was not of the _target field. it is of the path.

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

Open another page (not web) on C#

I'm creating a native C# application and I need to do a simple thing:
Once the user clicks some certain button, another .cs file is opened (with its own design, code and stuff). If it is possible, I would like to know how to close the current form at the same time.
EDIT: what I exactly need:
namespace Mokesciai
{
public partial class Mokesciai : Form
{
public Mokesciai()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//write code here to open another page called "NewPage.cs" with its own subfiles "NewPage.Designer.cs" and
//"NewPage.resx", as shown in the solution explorer
}
}
}
The application is C# Windows application
EDIT2: what I want in the graphical way: http://sdrv.ms/JXKVEL
By clicking "Click me" I want to open the new form
private void button1_Click(object sender, EventArgs e)
{
YourSecondForm objForm=new YourSecondForm();
objForm.Show();
this.Close();
}
Assuming YourSecondForm is the name of your another form which you want to display on the button click event.
That is a form.
You can create a new instance of the form class, then call Show().
As far as i understand from your question, may be you want to do this. You can use Process.Start() to start any other application from your native app.
using System.Diagnostics;
string path=#"path to the app"
Process.Start(path);
OR
Create a new form place a multi line text box, then read the file using StreamReader & fill its result on the text box. For more information on how to use Stream Reader Check out this or this

Categories

Resources