Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table in vb.net windows form 1

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
I have a table having some 4 rows. I need to design a table containing all the 4 rows and display it in the form. Is it possible to write html code for creating a table and display it? Or is there any other way?
 
First, I believe, you need to put a WebBrowser control in your form. Second, create a string object then put it in the DocumentText property of the WebBrowser control.
 
I am new to .net, can you explain it step by step with an example?
 
It is a windows application. If i place the web browser control in windows form, what are the software requirements to deploy the application on other machines?
 
i have placed the code like this,
WebBrowser1.DocumentText = "<html><body><table border=2><tr width=100%><td>Date</td><td>Con Pack</td><td>Region</td><td>Trade</td><td>Duration</td></tr></table></body></html>"

now i am getting the header correctly only but i want to display 4 rows in table ie, i want to retrieve the data from database and display in the display. how to print more then 1 row. i place another <tr> with the dataset columns then i am getting only the header and the last row in the dataset.


 
WebBrowser control is part of the .Net Framework. You do not need additional software to be installed.
Okay, you made a good start, now all you need to do is populate those datarows. For example:
Code:
Dim OutString As String = "<html><body><table border=2><tr width=100%><td>Date</td><td>Con Pack</td><td>Region</td><td>Trade</td><td>Duration</td></tr>" [blue]'</table></body></html> [/blue]
'Put the blue phrase at the end of the string.
'Now, populate the rows
For Each r As DataRow in YourDataTable.Rows()
    OutString &= "<tr><td>" & r("DateColumn") & "</td>" & _
                 "<td>" & r("ConPack") & "</td>" & _
                 "<td>" & r("Region") & "</td>" & _
                 "<td>" & r("Trade") & "</td>" & _
                 "<td>" & r("Duration") & "</td></tr>"
Next
OutString &= "</table></body></html>"

WebBrowser1.DocumentText = OutString

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top