Posts

Showing posts from July 12, 2009

How to check if there is any alphabet or non alphanumeric character in a string

Sometimes in our Project we may need to check if a particular string can be converted to a number or not. In practical world any string can be converted as Number if it contains only number Or essentially it should not contain any non alphanumeric character or alphabet. In my project, I faced a problem while creating search and Match engine, I needed to match a string with Salary column when it is eligible for getting converted to a number. I had seen many approaches on internet but then decided to write my own to make it very easy. I have written the following C# code with the help of Regex class to achieve the same. See full detail: http://www.c-sharpcorner.com/UploadFile/prasoonk/RegularExpressiontocheckforAplhabet06182009074514AM/RegularExpressiontocheckforAplhabet.aspx

How to highlight rows in a DataGrid using a CheckBox

This is for highlighting rows in a DataGrid using a CheckBox private void dgvItemsDetails_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgvItemsDetails.Columns[selected.Name].Index == e.ColumnIndex) { dgvItemsDetails.MultiSelect = true; if (Convert.ToBoolean(dgvItemsDetails[selected.Name, e.RowIndex].FormattedValue) == true) { dgvItemsDetails[selected.Name, e.RowIndex].Value = false; } else { dgvItemsDetails[selected.Name, e.RowIndex].Value = true; } } int i = 0; foreach (DataGridViewRow dgvrow in dgvItemsDetails.Rows) { if (Convert.ToBoolean(dgvrow.Cells[0].Value.ToString()) == true)

WPF RepeatButton

Creating a RepeatButton The RepeatButton XAML element represents a WPF RepeatButton control. < Button /> The Width and Height attributes represent the width and the height of a RepeatButton. The Content property sets the text of button. The Name attribute represents the name of the control, which is a unique identifier of a control. The code snippet in Listing 1 creates a Button control and sets its name, height, width, and content. See full detail: http://www.c-sharpcorner.com/UploadFile/mahesh/RB06242009084723AM/RB.aspx

Managed code and unmanaged code in .NET

Image
In this article I will try to explain you managed code and unmanaged code in .NET with help of diagram and its execution process. .NET supports two kind of coding Managed Code Unmanaged Code Managed Code The resource, which is with in your application domain is, managed code. The resources that are within domain are faster. The code, which is developed in .NET framework, is known as managed code. This code is directly executed by CLR with help of managed code execution. Any language that is written in .NET Framework is managed code. Managed code uses CLR which in turns looks after your applications by managing memory, handling security, allowing cross - language debugging, and so on. Unmanaged Code The code, which is developed outside .NET, Framework is known as unmanaged code. Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications, which, for example, access low - level functi

Creating rich mobile User Interface

Image
Creating rich mobile User Interface The success of contemporary mobile applications is determined by both, rich functionality and attractive GUI. Let's find a way how to be successful and effective in development of such applications. When developing a mobile app you can decide on platforms such as Android, Windows Mobile, iPhone. We will pick Windows Mobile from the three ones mentioned above. The reasons are quite obvious - the development is done in Microsoft Visual Studio - the most popular development environment in developer community. Many companies have already developed their desktop solutions using Visual Studio and have relevant knowledge and experience that can be used for creating mobile solutions. The only aspect that needs to be customized is UI. Moreover, Windows Mobile platform represent the largest market share, plus the mobile app can be easily uploaded to the device. We will use Visual Studio and C# programming language. In order to be successful we employ in t

.NET Framework and Architecture

Image
This article will help your in understanding .NET and .NET architecture. What is the .NET Framework? The .NET Framework is a new and revolutionary platform created by Microsoft for developing applications . It is a platform for application developers . It is a Framework that supports Multiple Language and Cross language integration. IT has IDE (Integrated Development Environment). Framework is a set of utilities or can say building blocks of your application system. .NET Framework provides GUI in a GUI manner. .NET is a platform independent but with help of Mono Compilation System (MCS). MCS is a middle level interface. .NET Framework provides interoperability between languages i.e. Common Type System (CTS) . .NET Framework also includes the .NET Common Language Runtime (CLR), which is responsible for maintaining the execution of all applications developed using the .NET library. The .NET Framework consists primarily of a gigantic library of code. Definition: A programming infrastr

Custom Action Filter in ASP.Net MVC application

Image
Objective This article will give an introduction of Action Filter in ASP.Net MVC framework. This will also explain how to create a custom Action filter. Action Filters in ASP.Net MVC framework Action filters are attribute This could be applied on a particular Action This could be applied on a Controller. This modifies the way Action executes. Custom Action filter could also be created and applied. ASP.Net MVC framework Action filters could be classified as, How to use an Action filter? Create a ASP.NET MVC application, by selection File->New->Project->Web Right click on Controller folder and add one controller. Feel free to give any name. Here name is TestController. Create an Action inside the controller. Feel free to give any name of the Action. Here name is TestingActionFilter() TestingActionFilter() action is returning current time as string. Apply Action filter OutputCache on the Action. Give required parameter for OutputCache action filter. 7. Run the application. 8. Ty

Operation Overloading in WCF

Image
Objective: This article will explain, What is Service Contract? How to achieve Operation overloading in Service. How to achieve operation overloading at client side. It explained the entire concept with supporting code as well. This will explain in detail of all the aspect of method overloading and manually configuration at client side. What is Service Contract? ServiceContractAttribute class is defined as It is defined under namespace System.ServiceModel. It got 6 properties. It could be applied either on service contract interface or service contract class. Could we achieve Operation overloading in Service Contract? How to achieve operation overloading? By using Name property of OperationContractAttribute class. OperationContractAttribute class Code Sample Service is having 3 overloaded operations. Add operation is taking different parameters. Name properties are being used to achieve overload operation. We will give aliased name to achieve overload using Name properties of Op

Working with ScrollBar Control in WPF

Introduction The ScrollBar tag in XAML represents a WPF ScrollBar control. The Width and Height properties represent the width and the height of a ScrollBar. The Name property represents the name of the control, which is a unique identifier of a control. The Margin property tells the location of a ScrollBar on the parent control. The Orientation property sets the direction of scrolling that can be either horizontal or vertical. The following code snippet sets the name, height, width, orientation, margin, and background of a ScrollBar control. See full detail: http://www.c-sharpcorner.com/UploadFile/mahesh/SBar06292009105859AM/SBar.aspx

InitParams in Silverlight

Image
Introduction If you are developing a Silverlight Application, and you need to pass some parameters inside – for example a key and value pair then we can pass the key value pair from the aspx page itself. We will see how we can do this in Silverlight. Create a Silverlight Project Figure 1.1 Creating Silverlight Project Adding parameters Open the "InitializingParametersTestPage.aspx" and find the tag tag < asp : Silverlight add an attribute InitParameters Enter the following code to the tag See full detail: http://www.c-sharpcorner.com/UploadFile/dpatra/InitParamsInSilverlight06302009024633AM/InitParamsInSilverlight.aspx

Passing parameter by param

The params keyword lets you specify a method parameter that takes an argument where the number of arguments is variable. Params parameter is a very useful feature in C#. It is used when we don't know the number of parameters will be passed to the called method. Param can accept multiple values or " params " should be a single dimensional or a jagged array. Practical demonstration of passing parameter by param See full detail: http://www.c-sharpcorner.com/UploadFile/puranindia/PassingParameterParam06302009003725AM/PassingParameterParam.aspx

RSS Widget 2 In Silverlight 3 with Data Persistence

Image
Introduction This is a new Version of my old RSS Widget Article. As you will see it has the feature of data persistence using ISO Storage. Creating the Silverlight Project We will create a simple Silverlight Project and name it as RSSFeedWidget2. Figure 1.1 Creating Silverlight Project Designing our Sample Application I have used Blend 3 to design our simple application. I have kept one TextBox where the user can paste the RSS Feed URL and two buttons, one for search feed data and the other one for adding the URL into persistence (ISO Storage). I have used three png images to accomplish my design. Figure 1.2 Designing the Application Checking for RSS URL in Persistence When the User control will be loaded, it will check the availability of the key and if present it would display the RSS Data, Otherwise it would give exception as no key found. The following code will achieve our goal. See full detail: http://www.c-sharpcorner.com/UploadFile/dpatra/RSSWidget2InSilverlight3WithDataPersist