Add Confirmbox in C# .NET 
Me.BtnDelete.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

[ add comment ]   |  permalink  |  related link  |   ( 3 / 2657 )
How to remove recent projects from Visual Studio Start Page 
1. Close Visual Studio if it is running.
2. Start the Registry Editor (run regedit).
Registry Editor
3. Navigate to this registry key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ProjectMRUList
Registry Editor 2
4. Then delete the key that has the project you do not want to keep in the list.


[ 1 comment ] ( 91 views )   |  permalink  |  related link  |   ( 3 / 11058 )
Run command in C# 
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();

//Do not receive an event when the process exits.
process1.EnableRaisingEvents = false;


string strCmdLine="/C curl -E \""+CertFile+"\":\""+CertPass+"\" -F orgid="+OrgID+" -F batchid="+this.BatchID+" -F userid="+PDSOID+" -F xml=@\""+this.XMLFilePath+this.XMLFileName+"\" "+UploadURL+" -o \""+this.XMLFilePath+"\\ServerResponse.xml\"";
try
{
System.Diagnostics.ProcessStartInfo sinf = new System.Diagnostics.ProcessStartInfo ("cmd.exe", @strCmdLine);
sinf.UseShellExecute = false;
sinf.CreateNoWindow = true;

process1.StartInfo=sinf;

process1.Start();
process1.WaitForExit();
process1.Close();

// or System.Diagnostics.Process.Start("cmd.exe",@strCmdLine);

this.ReadTransferLog("ServerResponse.xml");

return this.TranStatus;
}
catch (Exception ex)
{
process1.Kill();
npuInfoDB.DBConnection.LogErrorMessage(strCmdLine+"\n"+ex.Message);
return false;
}

[ add comment ]   |  permalink  |  related link  |   ( 3 / 9986 )
Read online file in C# 
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.theserverside.net");
System.Net.WebProxy myProxy = new System.Net.WebProxy("Your proxy goes here", 8081);
myProxy.BypassProxyOnLocal = true;
request.Proxy = myProxy;request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Timeout=20000;
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
Stream receiveStream = response.GetResponseStream ();
StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);
string result=readStream.ReadToEnd ();
response.Close ();


[ add comment ]   |  permalink  |  related link  |   ( 3 / 3474 )

BackBack