|
Windows Forms Drop Shadow
|
Total Hit (16121) |
«code LangId=3»public class Form1 : Form
{
private const int CS_DROPSHADOW = 0x00020000;
public Form1()
{
InitializeComponent();
}
protected override CreateParams CreateParams
{
get
{
....Read More |
Rating
|
|
|
Html Encoding and Decoding
|
Total Hit (6666) |
Some time you need funky code don't bother yourself by hard coding to every things when Microsoft give you facility.
Simply add refreces of System.Web to your project then where you need Encoding write this line
System.Web.HttpUtility.HtmlEncode()
Sample example
«code LangId=3»string String
....Read More |
Rating
|
|
|
|
Replace function in C#
|
Total Hit (8630) |
Currently C# has no replace function build in .net where are Vb.net has it. This function helps you to replace strings.
|
Rating
|
|
|
Unmanaged Memory Allocations
|
Total Hit (7413) |
If you are going to be using pointers, it may make sense to allocate from an unmanaged heap. For the vast majority of needs is not any better than the using the garbage collector, but if you are allocating a large amount of memory, especially for short periods of time, need better control of when me
....Read More |
Rating
|
|
|
Automatically hyperlink URLs in ASP.NET Pages
|
Total Hit (9779) |
Suppose that your ASP.NET pages display contents read from database fields. Suppose also that some of those fields may contain URLs or email addresses. A typical example is when you display user information such as the email address or the personal Web site. By using regular expressions, you can aut
....Read More |
Rating
|
|
|
Better user experience with the SmartNavigation property
|
Total Hit (2992) |
During a page postback, the page is redrawn by default and users see a short but annoying flickering. Worse, the scroll position isn't preserved during postbacks (the page scrolls to its top) and the first control on the page takes the input focus. This behavior contrasts with the experience that us
....Read More |
Rating
|
|
|
Creating a default button for the page
|
Total Hit (2538) |
It is usual for a web form to have more than one button control. How can you set the default button that should submit the form and raise its Click event on the server when the enter key is pressed on the form? The textbox and the other input controls don't have a property that allow you to specify
....Read More |
Rating
|
|
|
Creating a popup calendar control
|
Total Hit (9175) |
Many data entry forms have one or more text fields that the user should fill with a date value. Many sites have a button near these fields that when clicked pops up a new small window with a calendar, to help the user select the date. When the user clicks on a day (rendered as a hyperlink), this pop
....Read More |
Rating
|
|
|
Creating multi-steps input forms
|
Total Hit (2891) |
In a typical user registration form, you may ask for quite a lot of data, such as the first and last name, full address, phone and fax numbers, e-mail address, newsletters subscriptions and other data for the site personalization. All this data shouldn't the asked in a single step, because a long li
....Read More |
Rating
|
|
|
Disabling the session state to improve performances
|
Total Hit (2711) |
Sessions management consumes server's resources and memory, thus, if you don't use them in your application, you should disable them to improve performances. You can disable sessions for the entire application by setting to False the mode attribute in the web.config's <sessionState> tag, as follows:
....Read More |
Rating
|
|
|
Discern among servers with the MachineName property
|
Total Hit (2806) |
As in classic ASP, you can use the Server object from inside any ASP.NET application. This property returns a reference to an HttpServerUtility class.
The HttpServerUtility class exposes only two properties: ScriptTimeout (the timeout in seconds for a request) and the new MachineName property, wh
....Read More |
Rating
|
|
|
Don't preserve viewstate when doing a Server.Transfer
|
Total Hit (2994) |
The ASP.NET version of the Server.Transfer method accepts a second argument which, if true, causes the query string and all the form's fields to be transferred and made available to the destination page. However, when the destination page executes, the following error is likely to be generated:
....Read More |
Rating
|
|
|
Dynamically moving a server control
|
Total Hit (2755) |
Dynamically moving a server control instance on the page is very easy, thanks to the possibility to add any style attribute to the control. In this case, you can dynamically add the control's LEFT and TOP coordinates, and another attribute that says you want to use DHTML's absolute positioning. To t
....Read More |
Rating
|
|
|
Improve performance with the EnableViewState property
|
Total Hit (2687) |
All Web Forms controls, and the page itself, expose the EnableViewState property, a boolean that says whether the current value of the control must be saved in the __VIEWSTATE hidden field and restored during a page postback.
By default this property is True, which means that a field's value is
....Read More |
Rating
|
|
|
Input validation in ASP.NET 1.1
|
Total Hit (2637) |
ASP.NET 1.1 automatically validates input posted to the server against a list of potentially dangerous strings (the values are hard-coded, unfortunately, it would have been nice to be able to edit this list). For example, by default it prevents the user to submit text that contains "<script>", to pr
....Read More |
Rating
|
|
|
Parse URLs with the System.Uri class
|
Total Hit (3111) |
The Url and UrlReferrer properties of the Request ASP.NET object return a reference to the URL of the page and the URL of the page that referred to this one. Both properties return a System.Uri object; you can query the properties of this object to learn more about the address of the page that so yo
....Read More |
Rating
|
|
|
Passing values from a page to another by means of the Context object
|
Total Hit (2713) |
Sometimes you may want to gather the user input with a page, and process it in a different page. As you know, ASP.NET web forms can post only to themselves, so you can't just change the form's <i>action</i> attribute and make the form post to a different page. And anyway, you may want to do some pro
....Read More |
Rating
|
|
|
How to check 64-bit Operating System
|
Total Hit (7368) |
<b>VB.net</b>
«code LangId=2»
Public Shared ReadOnly Property Is64BitOperatingSystem() As Boolean
<SecuritySafeCritical> _
Get
Dim flag As Boolean
Return ((Win32Native.DoesWin32MethodExist("kernel32.dll", "IsWow64Process") AndAlso Win32Native.IsWow64Process(Win32Native.GetCurrentPr
....Read More |
Rating
|
|
|
|
C# Regex - Parsing URLs With Regular Expressions
|
Total Hit (3867) |
While the .NET Framework contains a class call Uri which provides a lot of functionality when dealing with URLs and URIs, it's not always easy to get at the pieces of a URL. I present a technique here using regular expressions to extract the subparts of a URI in one fell swoop. But first let's talk
....Read More |
Rating
|
|
|
Dynamically executing code in .Net
|
Total Hit (3986) |
Dynamic code execution is a powerful feature that allows applications to be extended with code that is not compiled into the application. Users can customize applications and developers can dynamically update code easily. In this article, Rick takes a look what it takes to execute code dynamically w
....Read More |
Rating
|
|
|
Basic Database Operations in ADO.NET
|
Total Hit (4720) |
This Article will show the basic database transactions select, insert update and delete. I am using MS-Sql database “northwind” for the demonstration. I am not going to use the class SqlCommandBuilder and I will tell you the reason later.
|
Rating
|
|
|
|
Part 1: An Introduction to Data Structures
|
Total Hit (3384) |
This article kicks off a six-part series that focuses on important data structures and their use in application development. We'll examine both built-in data structures present in the .NET Framework, as well as essential data structures we'll have to build ourselves. This first installment focuses o
....Read More |
Rating
|
|
|
Part 2: The Queue, Stack, and Hashtable
|
Total Hit (3272) |
This article, the second in a six-part series on data structures in the .NET Framework, examines three of the most commonly studied data structures: the Queue, the Stack, and the Hashtable. As we'll see, the Queue and Stack are specialized ArrayLists, providing storage for a variable number of objec
....Read More |
Rating
|
|
|
Part 3: Binary Trees and BSTs
|
Total Hit (3337) |
This article, the third in a six-part series on data structures in the .NET Framework, looks at a common data structure that is not included in the .NET Framework Base Class Library: binary trees. Whereas arrays arrange data linearly, binary trees can be envisioned as storing data in two dimensions.
....Read More |
Rating
|
|
|
Part 4: Building a Better Binary Search Tree
|
Total Hit (3348) |
This article, the fourth in the series, begins with a quick examination of AVL trees and red-black trees, which are two different self-balancing, binary search tree data structures. The remainder of the article examines the skip list data structure, an ingenious data structure that turns a linked li
....Read More |
Rating
|
|
|
|