0
Thank u Kedar very much .Sure.i will reply u if i get a solution.Hope u will let me know if u too get a solution
0
Hi Shaju..
what i feel is solution to your problem is you will have to send the sql query output to a text file...or when u do the data entery in datagrid view u will have write a code on save button to send the details to a text file. First do the process of saving the record and take that Id from master table and take all the sales items from details table do the query and send that whole date to a text file.. i am searching solution to print to a text file.. i have to do the same thing..i know how to do the query and all...i m searching for code to print to a text file..if ur using data set then ur job is quiet easy.. i am using ADODB so i not getting how to do that...i have some idea.. if ur using dataset then u can do it directly using "writeline" and streamwrite object. U try that else if i got solution i will send u the code..or another thing is u can do with crystalreportviewer. Its also easy way to do...but still u will have to use two button on that and then send that report to text file...
Hope u got idea... surely i will get solution soon. i will reply u...You can direct send to print and u can view it also..with "process.start("abc.txt")" and if u need more info about this u can check following site...http://www.dotnetperls.com/process-start
this is good one..reply if u got any solution..of sending query to txt file.
so that it will help me too..

0
I do not know whether you have understood what i have asked for.What i have shown above is just a sample of the sales bill which i should get printed through a dotmatrix printer.My question is how can i get a printout just in the same format as i have shown above when i click the print button.In my application i am entering all these data's on a datagridview with columns Sl.no,Item Name,Qty,Rate and Amount.And at last i am also calculating the Total .In short i should get the contents of this datagridview printed in the above format through a dotmatrix printer for making printing fast.
0
What I did was create a form with 2 buttons, printDocument1 and a printPreviewDialog1.
One button was called print, the other print preview (the latter just to make sure everything looked OK before printing.
I copied the supermarket text from above into "test.txt" file which resides in bin/debug folder
here is code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace SuperMarketPrint
{
public partial class Form1 : Form
{
string str;
Font myFont = new Font("Arial", 10);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
readTxt();
}
public void readTxt()
{
using (StreamReader sr = new StreamReader("test.txt"))
{
str = sr.ReadToEnd();
}
}
private void bttnPrint_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
private void bttnPreview_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString(str, myFont, Brushes.Black, 100, 10);
}
}
}

0
Thanks for your support.But the problem is that i cannot open the project file you provided because i think it is done in a higher version of Visual studio.I am using VS2005 and VS2008.So when i am trying to open it is saying the file is created in a higher version
0
See if this helps