The following VB.NET will make use of the SystemInformation class in order to obtain the battery charge status in percentages and the current power source: AC power / battery charging or battery power / battery not charging.
In ASP .NET, how do I set the script timeout?
You can use the following property (value in seconds): Page.Server.ScriptTimeout = 60; Also using this property you can retrieve the current time-out.
How to redirect to a different page using Response.Redirect in ASP.NET
You only need to use a simple method for redirecting to an URL in ASP.NET: Response.Redirect(). In the example below we are redirecting to http://www.geekpedia.com: Response.Redirect(“http://www.geekpedia.com“); You don’t have to type an absolute URL if the file is located on the same server. In that case you can use relative paths: Response.Redirect(“NewFile.aspx”);
Get current screen resolution in VB.NET
To get the current screen resolution in VB.NET you can use the Bounds.Height and Bounds.Width properties as such:
The name ‘Request’ does not exist in the current context
This error normally occurs when you are trying to access a property such as Request.Cookies and you’re not doing that from a webform, usercontrol or a class that inherits from System.Web.UI. Nothing to worry about, since you can still access these properties, but using a different path.For example to access a cookie with the name MyCookie you would normally […]
Determine if the computer is connected to a network
The following piece of code uses the My.Computer.Network.IsAvailable property to determine whether or not the computer is connected to a network. This network could be the Internet or a local network; for as long as the computer is connected to one such network, the response retrieved will be positive. This Visual Basic (VB.NET) code snippet is used […]
Internals Visible to Declarations Cannot Have a Version in SQL Server 2005 CTP
If you’re getting an error similar to the one below: [C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.SmoEnum\9.0.242.0__89845dcd8080cc91\Microsoft.SqlServer.SmoEnum.dll] InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified. (ObjectExplorer) If you’re getting this error when you try to connect to a SQL Server 2005 database using SQL Server Management Studio CTP, it’s because you installed .NET Framework 2.0 […]
How to get the current Unix timestamp in PHP
The Unix timestamp represents the time measured in seconds since the start of the Unix epoch (January 1st, 1970). The Unix timestamp is often inserted into databases, to date the records. Getting the Unix timestamp in PHP is done by using the time() function, which returns the current Unix timestamp of the server. Here we output the […]
How to retrieve a list of installed printers
Retrieving a list of available printers using .NET 2.0 is quite easy since it’s supported by the framework itself, and there’s no need to mess with unmanaged code. First add the using statement: Here’s the entire code in one page:
How to go back one page in the browser history using JavaScript
Using JavaScript you can go back or forward in the browser’s navigation history. Most of the time you want to go back one page by clicking a link in the page. For doing that, use the following code: <a href=”javascript:history.go(-1)”>Go back</a> It’s easy to figure out that to go back more pages in history, you […]