Hi friends
I m createing a project in which i am dynamically binding data to a datagrid. what i need is to print the data in datagrid in a report format. but i do not know that how to do it.
Plz help me, its urgent
Thanks in advance
Shivpreet2k1
Printable View
Hi friends
I m createing a project in which i am dynamically binding data to a datagrid. what i need is to print the data in datagrid in a report format. but i do not know that how to do it.
Plz help me, its urgent
Thanks in advance
Shivpreet2k1
it depends on the type of report you want to create.
if you just want to display data in the form of database tables
write the data to a csv(comma separated) file
if you want to create a report i'd use the string builder and write it to txt file
DEAR FRIEND
IWANT TO GET THE PRINT IN THE TABULAR FORMAT. COULD YOU PROVIDE ME ANY EXAMPLE. SO THAT I MAY GET THE CLEAR IDEA OF THE CODE THAT I SHOULD USE
BYE
Shivpreet2k1
Dim l_sWriter As New StreamWriter("mytextfile.txt")
Dim l_outLine As String
Dim l_noRows As Integer = datagrid1.visiblerowcount
Dim i As Integer
For i=0 to l_rows - 1
l_outLine = datagrid1.item(0,0) & vbTab & datagrid1.item(0,1) & vbtab & datagrid1.item(0,2)
l_sWriter.WriteLine(l__outLine )
l__outLine = ""
Next
l_sWriter.Close()
Dear friend
Thanks for your code but it is giving me syntex error. Do i need to include a refernce for that
Thanks in advance
Shivpreet2k1
i just wrote that in the forum without testing it so there are bound to be errors...
this is it without errors
Dim l_sWriter As New System.IO.StreamWriter("mytextfile.txt")
Dim l_outLine As String
Dim l_noRows As Integer = datagrid1.visiblerowcount
Dim i As Integer
For i = 0 To l_noRows - 1
l_outLine = datagrid1.Item(0, 0) & vbTab & datagrid1.Item(0, 1) & vbTab & datagrid1.Item(0, 2)
l_sWriter.WriteLine(l_outLine)
l_outLine = ""
Next
l_sWriter.Close()