Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

C#

Articles on C# programming language.

Drawing Shapes Via GDI+ Brushes and Pens

DotNet GDI Plus Pen and Brush Example

A ‘Pen’ is a graphic object, which can be used to perform line drawing. GDI Pen has the properties like the color of the Pen and thickness of the pen. A Brush is also a graphic object, which we can use to paint a region. Suppose if we want to fill the area of a closed shape, we can use the Brush. One can think about Painting a door, a wooden plate, etc. In this example, we will explore how to use the ‘Pen’ and ‘Brush’. In the brush part, we will look at ‘Plain Solid Brush’, ‘Gradient Brush’ and ‘Hatch brush’.

In this example, we will explore about the GDI+ Pen and Brushes and use them to draw some shapes in the window’s form.

Continue Reading →

RDLC Report & ReportViewer Control in C#

Designing the RDLC Reports - Page Header & Footer, Report Header, Footer & Details

In this RDLC Reports tutorial, we will explore how to generate the RDLC Reports using the Microsoft supplied report template (.RDLC file). We get the data from the ‘Titles’ table of the Microsoft supplied ‘Pubs’ database. In this example, the ReportViewer Control acts as a presentation UI.  To generate the report on the database table, we will use following things:

‘DataSource’ that supplies the data from the database.
‘Report Template’ that defines the visible elements and its location. [.RDLC file]
‘ReportViewer Control’ supplied by the dot net framework.
‘C-Sharp Form’ that houses the ReportViewer control in it.

Continue Reading →

Publish Application With One-Click Install

Publishing C# Application to a Shared Location

Publishing the application in a shared location is useful and pays off for both publisher and clients subscribed to the published application. In the publisher point of view, they no need to cut CDs and ship to every client. Also from the end user point of view, they will get the update to the application that they are using.

This example will explore,

Publishing the application in Network shared path
Providing the Update notification to the Client
Pushing the updates forcibly to the Installed client location

Continue Reading →

C# WebBrowser Control Explained

C# WebBrowser Control Example

The ‘C# WebBrowser Control’ provides the capability of browsing the web pages to our application. One can also display their own HTML content through the web browser control. That means he/she can generate all fancy reports in html content and then display that in a WebBrowser Control. In this example, we will explore how to design simple browsing window. Note, even though this example acts as a browser, when you are browsing using this sample, do not provide any sensitive information. This is just a sample that shows the use of WebBrowser Control. At the end, we will also explore how to display the user content with button click and hook that to the C# handler method.

Continue Reading →