Blog Archive
My Links
- C# Snippets: 1
- C# Snippets: 2
- XMLFOX - CSHARP SAMPLES
- Q: Export your Crystal Report data to PDF
- Q: To create a Excel report wihtout using Excel object model Ex
- Q: Using C#, How to Save,Update Data to and from XML with out using the sql server database
- Q: upload excel to SQL using C#.net,VS2005
- Q: Export DataTable to Excel using c# with Formatting Styles
- Q: Crystal report in c# .Net
- Q: Import excel into Sql server 2005 Table
- Q: READ, UPDATE & DELETE XML FILE USING X-PATH
- Q: Export Data from Listview to Excel
- Q: About GridView Data To Excel C#
- Q: Simple way to convert excel sheet to sql table
- Q: How to send data from c# file(.cs) to xslt file
- Q: How to Export and import data from sqlserver to excel sheet in vb.net
- Q: Migration of data from access to excel and vice versa
- Q: How to insert the data from excel to Database in .Net?
- Q: How can we create excel sheet in c# using data grid
- Q: DateTime Value Manipulation
- Q: create an array from a txt file
- Q: HowtoOepnandReadanExcelSpreadsheetinaListViewin.NET
- Q: How to fill data to excel
- Q: Reading Image from Excel file using C# .Net
- C# / CSharp Tutorial
- stackoverflow.com/questions
- General .NET Projects
- Sample .NET Projects with source code
- CSharpArticles
- PHPManual
- phpmanual/en/install.windows
- ProtoPage
Tuesday, September 8, 2009
How to make the numeric values as left alignment in DataGridView control ?
How to show the numerical values as Left alignment in the datagridview control as making the positions of the digits (like Thousand hundreds tens ones)
How to compute the numeric values of DataGridView's Column [Field] and result value to be in next row?
C#:
In my application program, i had placed a DataGridView for tabular format. Here what i
need is to calculate the numeric values of a column which is in datagridview and the
result should be in the next row of that column and/or some other textbox named as resulttb.
For Example,[from the below figure] i need to calculate the total sum of the numeric
Field"Execution" like (15+25+2000+500000+10 = 502050)& "Sup_Execution" like
(2+2+50000+100000+100=150104) these total results should be placed in followed row of that
field and also in the resulttb textbox control.
And also i needs to calculate "Total"field(hidden) that the value get from the fields
(Execution) * (Sup_Execution) of row wise.
Sunday, August 23, 2009
"PrintForm" Component, available in .NET 3.5 SP1
Place a ToolstripButton on to the Form :
private void toolStripButton2_Click(object sender, EventArgs e)
{
if (this.ActiveMdiChild == null)
return;
printForm1.Form = this.ActiveMdiChild;
printForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPreview;
printForm1.Print();
}
How to see Print Preview & Print a WindowsForm

using System.Drawing.Printing; //For "PrintDocument" Class
public partial class Form3 : Form
{
PrintDocument PrintDoc1 = new PrintDocument();
PrintPreviewDialog PPDlg1 = new PrintPreviewDialog();
public Form3()
{
InitializeComponent();
PPDlg1.Document = PrintDoc1;
PrintDoc1.OriginAtMargins =true; //To set or Get the Position of a Graphic Object
PrintDoc1.PrintPage += PDoc_PrintPage;
}
private void btn_PrintPreview_Click(object sender, EventArgs e)
{// When PrintPreview Button Clicks
PPDlg1.ShowDialog();
}
private void PDoc_PrintPage(object sender, PrintPageEventArgs e)
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
//this.DrawToBitmap(bmp, this.ClientRectangle);
this.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height)); //Takes the Snap of the Exact WindowForm size as Bitmap image
e.Graphics.DrawImage(bmp, 0, 0);
}
private void btn_PrintPage_Click(object sender, EventArgs e)
{//When Print Button Clicks, Image will be show & Ready to Print
PrintDoc1.Print();
}
}
Wednesday, August 19, 2009
Deployment of a Windows Forms / Console Application
On the Build menu, choose Rebuild all Projects, to make sure that the client application,
To create a deployment project
1. On the File menu, point to Add, and then click New Project.
2. In the Add New Project dialog box, in the Project Types pane, open the Other Project Types node, click Setup and Deployment Projects, then click Setup Project in the Templates pane. In the Name box, type <project_name>_Setup.
3. Click OK to close the dialog box.
The project is added to Solution Explorer, and the File System Editor opens.
4. Change ProductName property and remove "_Setup" from default ProductName name
· Select the <project_name>_Setup project in Solution Explorer. In the Properties window, select the ProductName property and type <project_name> without _Setup.
| Note: · The ProductName property specifies the name that will be displayed for the application in installation folder names and in the Add/Remove Programs dialog box. |
5. Change Manufacturer from ‘Default Company Name’ property to xxx . Then the MSI will install your application installed into the c:\Program Files\xxx\<project_name>\ folder
To add the WinForms / Console application to the installer
1. Right-click the \<project_name>_Setup project in Solution Explorer.
· View -> File System
· In the File System Editor, select the Application Folder node.
2. On the Action menu, point to Add, and then click Project Output.
3. In the Add Project Output Group dialog box:
- choose \<project_name> from the Project drop-down list
- Select the Primary Output group from the list
- In the Configuration box, select (Active).
- Click OK to close the dialog box.
To create Program Files folder & menu
Select the \<project_name>_Setup project in Solution Explorer.
1. Normally Install will, by default, restrict installation to a single user. If needed, in Project Explorer, click Setup Project name, view properties list, and set “InstallAllUsers” to true.
1a. In the File System Editor, right-click User’s Program Menu.
2. Add -> Folder and Rename Folder to <project_name>
3. In the File System Editor, in the Application Folder, select the Primary output from <project_name> node.
4. Right Click -> Create Shortcut to Primary Output.
5. Rename the Shortcut to <project_name>.
6. Select the Shortcut and drag it to your User’s Program Menu folder in the left pane.
To add an icon for Program Files folder & menu
- In the File System Editor, click User’s Program Menu. then in the right panel, right-click the shortcut (not the folder).
In the Properties window, select the Icon property and choose (Browse...) from the drop-down list. The Icon dialog box will be displayed.
In the DropDownListBox, choose "User's Program Menu"
Click the Add File Button, then browse for the Icon file.
The Icon dialog box will be displayed.
In the DropDownListBox, choose "User's Program Menu"
Click the Add File Button, then browse for the Icon file.
Rebuild the _setup project, then you should be ready !
..
Tuesday, August 11, 2009
Load Crystal Report from File
This code will show how to load a crystal report .rpt file that is saved on a local drive instead of embedded. The advantage to this is the program does not need to be re-compiled each time a report is modifed. Also, the .rpt can be upload from the application and stored in a database and then written to file. Do not embed the .rpt file when using this method.
using System;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace Report
{
public partial class Report : Document
{
public void ReportLoad()
{
ReportDocument reportDocument = new ReportDocument();
string filePath = "C:\Projects\Application\Report\CrystalReport.rpt";
reportDocument.Load(filePath);
crystalReportViewer.ReportSource = reportDocument;
}
}
}
..
