Dotneter - dotneter.com - NameTrove
General Information:
Latest News:
How to add icon to website 17 Nov 2011 | 10:50 pm
To add an icon for the website you just add the following code to the head element: <LINK REL="SHORTCUT ICON" HREF="http://www.domain.com/iconname.ico"> CODE Example: <HEAD>...
Get Connection String from app.config, web.config 16 Sep 2011 | 06:35 pm
Get connection string by connection’s name string conn = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString; or string conn = ConfigurationManager.ConnectionStrings...
Copying Rows from One Table to Another – C# 15 Sep 2011 | 11:56 pm
Use Clone method to copy the table structure (Schema) DataTable dtProductCopy = new DataTable(); dtProductCopy = dtProduct.Clone(); Use the ImportRow method to copy from...
Get Windows Folder using C# 15 Sep 2011 | 09:20 pm
Environment.GetEnvironmentVariable("SystemRoot"); or Environment.GetEnvironmentVariable("windir");
Get current username in Windows using C# 15 Sep 2011 | 09:18 pm
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Get the Computer Name using C# 15 Sep 2011 | 09:12 pm
System.Windows.Forms.SystemInformation.ComputerName.ToString(); or System.Environment.MachineName;
Check if the current user is Administrator using C# 15 Sep 2011 | 09:03 pm
using System.Security.Principal; private bool isAdministrator() { WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent(); WindowsPrincipal windowsPrincipal = new WindowsPrincipal(windowsIden...
Get system uptime using C# 15 Sep 2011 | 08:33 pm
string uptime = String.Empty; uptime += (Environment.TickCount / 86400000).ToString() + " days, "; uptime += (Environment.TickCount / 3600000 % 24) + " hours, "; uptime...
Hibernate the Computer using C# 15 Sep 2011 | 08:15 pm
For hibernate you can just call Application.SetSuspendState. using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Windows.Forms; namespace Win...
Logoff the Computer using C# 15 Sep 2011 | 08:08 pm
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace Dotneter.com { class Program { static void Main(string[] args) { Process.Sta...