Printing datagridview in any printers

Posted: 11th January 2011 by pons_saravanan in Uncategorized
Comments Off

Printing Datagridview using VB.Net

There will be situations to just print a DataGridView in a application than designing again the columns and rows in a Crystal Report. But in .Net there is no straight forward way to do this or in other words this is not supported natively. To print the Datagridview using any types of printers, we need to draw all the objects using Graphics Object given in the PrintDocument before calling print method in the respective PrintDocument.

PrintDocument and the Graphics Object

So as I earlier said we need to actually draw all including text using the Graphics object. The print document needs to be prepared before actual printing starts. So we can use the event PrintPage, in this event we can draw all the objects as we need.

Draw the DataGridView like a table using lines

To get a tabular data to represent the DataGridView, we need to do the following

• Draw an outer rectangle as the border to table
• Draw a line for every row
• Draw a line for every column while iterating the cell
• Draw the cell value as text
All the above said items can be drawn with the help of the DataGridView’s native properties, Left, Top, Height, Width, Row.Hieght, and Column. Width

 

Personalized Car Floor Mats

Posted: 10th May 2010 by pons_saravanan in Uncategorized
Comments Off

Personalized car mats are usually designed to suit our taste or can be manufactured based on the given specifications. Personally I feel a good car mat will reduce your effort in keeping the car clean. It actually protects your car floor from getting damaged also

Types of floor mats

There are different kinds of mats available. Depends on the material used we can use them for various situations. Some of them are heavy duty, some of them are easily cleanable, and some of them are looks pretty. Few example Rubber mats, vinyl mats, carpet mats and coil mats.

How the Custom Car Mat done

Companies take orders by the car make, color and material. The car mat can be designed even though to your taste from the basic design templates for the respective car make.

Advantages of a custom Car Mat

Personalized car mats can be a very reasonable solution to the problem of wearing and tearing of your old factory fitted vehicle’s carpets.

You can make your personalized car mats to be done in a way that it will correct some problems you encounters with factory fitted mats.

You can choose the materials that can last long with usage without the problem of discoloration or tearing

Personalized car mats give more satisfaction because it is designed and set according to your taste. You can determine the color and arrangement for all seating rows and cargo areas and make them look as you want.

Personalized car mats will keep wetness from reaching your floors just by choosing the right materials that do not retain water or that run it off easily like vinyl and rubber.

With personalized car mats you also have the advantage of determine what to spend.

You can cut down cost by carefully planning and selecting what you want and still enjoy the qualities or special features that you desired
Original article is here (Personalized Car Mats)

Crossovers for Cars

Posted: 19th March 2010 by pons_saravanan in Uncategorized
Comments Off

Crossovers are usually used to filter the frequencies that are not required for the specific speaker setup. When you put a crossover for the tweeter, usually high frequencies only be allowed. And the same time the low frequencies should be filtered. Other wise tweeter may get damaged due to heavy movement of voice coil. Like said for woofers the high frequencies should be filtered and low frequencies only allowed. For mid range speakers the peak high and peak low frequencies are removed.

Crossovers are normally comes in two flavours, either passive or active

Passive crossovers
Passive crossovers do not need the power for the circuit. Usually for a tweeter, a capacitor range around 4.7 micro farad will be used in series with the tweeter. For Woofers, a capacitor can be run in parallel and coil( inductors ) can be running in series to form. This is to just to have an idea of how this passive crossovers working. But the gauge of the coil, value of the capacitor, wiring coil and capacitor in parallel or series, using ferrite core for the coil all should be based on the circuit you have designed or bought.

Basically there are a lot of passive crossovers are available in the market so we can get the specific one we need. Usually the passive crossovers will be placed between the amplifier and the speakers.

Active crossovers
Active crossovers need the power supply to function. These crossovers will not be placed between amplifier and speaker. But they will be placed usually between preamplifier (in our case head unit) and amplifier. So before passing to amplifier the frequencies that are not are favourable will be eliminated from the stream. Ok now the problem comes in. As the high frequency and low frequency is filter even before amplifier, there should be a separate amplifier for the low frequency and high frequency. But the output quality will be very nice in practise.

For More Information(Car Crossover)

Car Stereo Amplifiers

Posted: 19th March 2010 by pons_saravanan in Car PC
Comments Off

Do you listen to music while driving all the time if not mostly? Then adding an amplifier to your car stereo will be the right choice, as it is going to give you way good response than the stock system.

Amplifier Requirements
When choosing an amplifier, we need to get at least the following information.
1) RMS and PMPO and signal to noise ratio of the circuit.
2) Output impedance
3) Rated voltage and power requirement
4) Frequency response.

Car Stereo Amplifiers Installation
Installing a car audio amplifier yourself is an easy task that not only saves some money but also will give the confidence on improving the system over the time by you. I know you will not stick to the system for the rest of the life. This article shows you car amplifier installation. The ideal location for the amplifier in my opinion is under the co-drivers seat.

Read More here(Car Stereo Amplifiers)

Compare Duplicate files in VB.Net

Posted: 18th March 2010 by pons_saravanan in Uncategorized
Comments Off

MD5 hash to compare Duplicate files

When you are receiving files from different sources but the content is same, there is a possibility of having a different filename for the same content. Hence finding a duplicate file just by file name may not be sufficient. To compare by file data, there are several ways.

Usage of Message Digest (MD5)

To find duplicate files even after renamed, the content/data has to be compared after the content of files fetched. Once the file content is in data format, the data can be encoded with MD5 hash algorithm. The string result after hash can be used for comparing. MD5 is a widely used cryptographic hash function with a 128-bit hash value, and is also commonly used to check the integrity of files

MD5 in .Net Framework

.NET Framework has very rich support for encrypting and decrypting. Computing hashes and encrypting data using a variety of algorithms is very easy. Use the ComputeHash() method to compute the MD5 Hash.

Computed Hash to compare

For the MD5 to work we should give which encoding it should follow, basically we are using ASCIIEncoding. This same function can be used in a recursive call to check all the duplicates. Once all
the files in the directory are scanned and compared it is much easier to delete the duplicate files found.

Read more with source code (Compare duplicate files using VB.Net)

VB DataTable Sort

Posted: 10th February 2010 by admin in Uncategorized
Comments Off

Sorting Data in a DataTableWhen there is a need of sorting rows in a DataTable, there is no direct support available in DataTable. There is no direct way to get the sorted records into a DataTable out of the box. There are few ways to sort the data in the DataTable but that needs a few lines of code that I would like to discuss here. We have already discused how to sort a records in Gridview using DataView.Sorting using DataView Basically I like the DataView to sort the records as there is a support natively available as a property DataView.Sort. And the sorted records can be forced to a DataTable using a ToTable () method in a DataView. Not only sorting available but also there are other useful functions like filter, and distinct etc… So we can filter and sort altogether.Sorting using a select method in DataTableLike I said earlier there are few ways to achieve sorting in the DataTable. The select method of the DataTable also offers …

Read More VB DataTable Sort

GridView Sorting Vb.Net

Posted: 19th January 2010 by admin in Uncategorized
Comments Off

ASP.Net GridView Sorting GridView sorting is very easy to enable. But only few functionalities are available out of the box, so still a few things should be configured and coded. The first thing to enable sorting is AllowSorting = true. Then SortExpression has to be specified. Normally column name has to be given for the SortExpression. With this the GridView view will be able to sort based on the SortExpression given.GridView’s Sorting EventAfter configuring the above when you click on the sort link in the header of the respective column, an exception will be thrown that the Sorting event is not handled. In this event we need to sort the data using a DataView. DataView has a Sort which we can use to pass the expression.Switch Ascending and descendingActually when a GridView is sorted in either ascending or descending order the next expected has to be opposite for the first sorting. If the first sorting is ascending then the second sort …

Read More GridView Sorting Vb.Net

Comments Off

VB calculator codeThis article is mainly for the beginners. I am trying to explain the use of Control Arrays with the help of Calculator Sample.I feel control arrays are overlooked in classic visual basic. if the way to implement is understood, it is much useful in reducing the code. Control Arrays can be used in the situations like whenever the need of same controls being used several times in an application. We can make them as an array, and the controls can be accessed by their index in all the respective eventsVB 6 Control Arrays in formAs shown in the following figure, Design the form. Create a Command Button named as Command1 and copy that and paste it 11 times. This will create a control array. Then assign the text as shown in the figure. all the controls under red boxes are under one group. So design it accordingly.like wise create cmdOperator control array for the green box group. <b …

Read More Visual Basic Calculator Code using Control Arrays

Comments Off

Float to align controls inlign1Whenever DIVs are used in html markup, the DIVs are tend to flow vertically. Some times we may need to place them horizontally inline.We can handle this using the float style. As followsfloat: left;float: right;If Div1 and Div2 have to be placed inline then<div id=”Div1″ style=”float:left”><div id=”Div2″ style=”float:right”> …

Read More Display Div inline like a Span Using Style Sheets

Remove Scroll bars with CSS

Posted: 18th January 2010 by admin in Uncategorized
Comments Off

What is OverFlowThe overflow indicates the browser to fit the content in a container as per the . Since the fit is based on the width and height, the property has to be used along with proper width and height. Otherwise it is going to be useless. There are few possible values for OverFlow, those are visible,hidden,auto,scrollBut for removing scroll bar use overflow: hidden; …

Read More Remove Scroll bars with CSS