visual studio 2010 - Get data into tabular format on printing in vb.net -
i have program takes attendee’s names , contact details , writes them text file. in all, there 20 rows , 5 columns used in form when user clicks on ‘save’ button, these details written text file.
the code using works fine, , shown below. please note code truncated first attendee only.
dim attendeedata = new directoryinfo(path.combine(environment.getfolderpath(environment.specialfolder.desktop), "attendee information\" & textbox1.text)) dim filenametxt string = path.combine(attendeedata.fullname, "attendee data" + ".txt") dim filetxt new system.io.streamwriter(filenametxt) ‘write attendee details text file ‘attendee number 1 filetxt.write(form1.textbox2.text) ‘attendee’s name filetxt.writeline("") filetxt.write(form1.textbox3.text) ‘attendee's nationality filetxt.writeline("") filetxt.write(form1.textbox4.text) ‘attendee's position filetxt.writeline("") filetxt.write(form1.textbox5.text) ‘attendee's email filetxt.writeline("") filetxt.write(form1.textbox6.text) ‘attendee's telephone no. filetxt.writeline("") ‘attendee number 2 ... attendee number 20 'the below line of code closes writer filetxt.close()
i decided use method because @ point, text file has read text file, textboxes on form.
my problem when comes reporting, printing out these details in above format cumbersome, using sheets of paper make report unnecessarily plentiful. reckoned displaying these data in tabular format more tidy , professional.
please how can achieve this? using visual basic 2010 express. thank in advance.
the code using in printing shown below:
private sub button1_click(sender system.object, e system.eventargs) handles button1.click dim attendeedata = new directoryinfo(path.combine(environment.getfolderpath(environment.specialfolder.desktop), "attendee information\" & textbox1.text)) each attendeedetailstxt fileinfo in attendeedata.getfiles("*.txt", searchoption.topdirectoryonly) each line string in file.readalllines(attendeedetailstxt.fullname) if not string.isnullorempty(line) richtextbox1.appendtext(line & vbcrlf & vbcrlf) next next ' send data printing script end sub
how recording attendee's information in structured format such xml?
writing data xml in code quite simple - here article on subject: http://vb.net-informations.com/xml/create-xml-vb.net.htm
reading data application simpler no longer have rely on lines in unstructured input file being in particular order cause issues data being out of sync if, example, line missing.
displaying data more tricky have use xslt display data in tabular form there plenty of resources online started such w3schools: http://www.w3schools.com/xsl/xsl_transformation.asp
Comments
Post a Comment