StrategicGnomer
asked on
Basic C# commands?
I'm learning C# to do a project and hopefully a job but I have no knowledge in it at all so I'm just trying to do a few things to get started, first, let's say I have a button on the page and I want it to link somewhere, what's the command to link to a web page? and secondly, anyone know of a good way to learn some basics? a good book, a good video training thing etc? Thanks!
ASKER
not sure if i got this right, here's what I got...
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls. WebParts;
using System.Web.UI.HtmlControls ;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public static bool IEOpenOnURL(string sURL)
{
InternetExplorer oIE = (InternetExplorer)NSLibSta tic.COMCre ateObject
("InternetExplorer.Applica tion");
if (oIE != null)
{
object oEmpty = String.Empty;
object oURL = sURL;
oIE.Visible = true;
oIE.Navigate2(ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
return true;
}
protected void Button1_Click(object sender, EventArgs e)
{
IEOpenURL("http://www.yahoo.com");
}
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
using System.Web.UI.HtmlControls
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public static bool IEOpenOnURL(string sURL)
{
InternetExplorer oIE = (InternetExplorer)NSLibSta
("InternetExplorer.Applica
if (oIE != null)
{
object oEmpty = String.Empty;
object oURL = sURL;
oIE.Visible = true;
oIE.Navigate2(ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
return true;
}
protected void Button1_Click(object sender, EventArgs e)
{
IEOpenURL("http://www.yahoo.com");
}
}
ASKER
oh snap, forgot to mention, using asp.net 2.0 with visual studio 2005 and i'm using c# as the default language
I figured that from all the system.web usings
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that is exactly what i was looking for thanks.
Excelent how to and free
http://www.csharp-station.com/
add the button double click it to open the coding page and create the click event and click method
// <summary>
/// Opens a new Internet Explorer window and navigates it to the URL.
/// This code is for demonstration purposes only.
/// </summary>
/// <param name="sURL">URL to navigate to.</param>
/// <returns>true all the time.</returns>
public static bool IEOpenOnURL (string sURL)
{
InternetExplorer oIE = (InternetExplorer)NSLibSta
("InternetExplorer.Applica
if (oIE != null)
{
object oEmpty = String.Empty;
object oURL= sURL;
oIE.Visible = true;
oIE.Navigate2 (ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
return true;
}
call like this
IEOpenURL ("http://www.NovickSoftware.com");