|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
create table in html file within vb6
hello everybody
i'm working in my vb6 project.i have already created a .htm file and i want to create a table in that file.i have used vbcrlf to take records from my database in that .htm file .this is the code that i have used to create and print records in .htm file at vb runtime Open "abc.htm" For Output As #3 ' creates file "abc.htm" Print #3, rs1.GetString(,100,vbtab, vbCrLf," "); 'prints selected records in the file Close #3 'closes the file file automatically creates at runtime and records will go according to user's choice but records are coming in a single line but i want to create a table so that records can come in a table itself . plz anyone help me i'll be greatful to him/her. |
|
#2
|
|||
|
|||
|
Hi malika,
Instead of using vbCrLf as RowDelimeter use "<br>" tag in ur code i think it will give the expected out put, Code:
Open "abc.htm" For Output As #3 ' creates file "abc.htm" Print #3, rs1.GetString(,100,vbtab, "<br>"," "); 'prints selected records in the file Close #3 'closes the file Regards, Satish Kumar J.. |
|
#3
|
|||
|
|||
|
sorry satish its not workintg .actually i have used that vbcrlf for taking selected records from my database.but here in my html file i want to show that records in tabular format.only tell me the way to create that table
|
|
#4
|
|||
|
|||
|
Hi malika,
I will write a code for ur requirement, if u think that is longest way then leave it a side I am not writting whole code, i am giving u the idea... 'sample code Code:
Dim StrHtml as String StrHtml = "<table align='center' width='100%'>" do not rs.eof StrHtml = StrHtml & "<tr>" For i=0 to rs.fields.count-1 StrHtml = StrHtml & "<td>" & rs(i) & "</td>" Next StrHtml = StrHtml & "</tr>" rs.movenext loop StrHtml = StrHtml & "</table>" Open "abc.htm" For Output As #3 ' creates file "abc.htm" Print #3, StrHtml 'prints selected records in the file Close #3 'closes the file Hope this will helps u, Regards, Satish Kumar J... |
|
#5
|
|||
|
|||
|
thanks Satish.like Access i have to create a table in .htm file using vb6 at run time and datas should come in that table itself.for e.g in Access or in excel too many columns and rows are there and datas come in that rows and column itself.like that i hve to show datas in atable in my .htm file using vb6 at runtime
|
|
#6
|
|||
|
|||
|
Quote:
Hi, I am sorry i not getting u properly, if u need data in tabular format then use Code:
border='1' if ur requiment is not what i am thinking sorry for disturbance... Cheers, Satish |
|
#7
|
|||
|
|||
|
no not at all.thanks yaar .thanks a lot .your code works it represents data in a good manner means daas are coming like this.
name city Madhu Delhi before applying your code all datas are coming in a single line .but now this is fine but only problem is tables are not created.when i click on"edit with Microsoft Word" then in MS Word table is created and datas are coming in the table.i cannot draw a table here there is no tools available.i think now u r clear whats my doubt. |
|
#8
|
|||
|
|||
|
Hi malika,
I am changing some of the code i have given u last time so that it will display the table format in the htm file Dim StrHtml as String StrHtml = "<table align='center' width='100%' border='1'>" StrHtml = StrHtml & "<tr aling='center'><th width='50%'>Name</th><th width='50%'>City</th>" do not rs.eof StrHtml = StrHtml & "<tr>" For i=0 to rs.fields.count-1 StrHtml = StrHtml & "<td>" & rs(i) & "</td>" Next StrHtml = StrHtml & "</tr>" rs.movenext loop StrHtml = StrHtml & "</table>" Open "abc.htm" For Output As #3 ' creates file "abc.htm" Print #3, StrHtml 'prints selected records in the file Close #3 'closes the file Cheers, Satish |
|
#9
|
|||
|
|||
|
thanks a lot Satish.thanque very much.your code is working very well.table is creating in html and datas are displaying in columns and rows.ver very thanks.you're great.
with regards madhu |
|
#10
|
|||
|
|||
|
Hi madhu,
you are welcome any time u can directly contact me at j_satish_kumar@hotmail.com i think ur praising me more................ ![]() Regards and happy coding. Satish Kumar J. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > create table in html file within vb6 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|