CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2014
    Posts
    7

    WebBrowser control report application

    Hi Folks,
    need some help to create tables, which will be displayed as webpages-HTML code, using WebBrowser control. Table will show catalogies of products (clothes), which needs to be displayed as HTML table.
    Should be 4 categories of tables-reports: Women, Men, Kids, Combined, which will be chosen by hitting button: attached screenshot
    Table should display separate cells: The Product name, Price, and Units In Stock. Like for example hitting "Men" button should display: Product name, Price, and Units In Stock.
    The information needs to be pull out of doctext file:


    Category,ProductName,Price,UnitsSold,UnitsInStock
    men,shoes,20,34,6
    men,boots,30,23,8
    men,pants,15,51,4
    men,waists,10,67,3
    men,shirts,10,34,3
    men,shorts,10,53,5
    women,shoes,20,78,7
    women,boots,30,13,8
    women,pants,15,43,1
    women,dresses,40,52,3
    women,skirts,20,67,5
    women,sweaters,30,43,1
    kids,shoes,10,45,9
    kids,pants,10,32,4
    kids,shorts,7,87,2
    kids,shirts,7,43,3
    kids,sweaters,15,64,8
    kids,skirts,10,23,4

    Can use Mid(), Len() and Instr(), but no Split()
    There is code, which is for reading one line only


    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim Price As Double
            Dim UnitsSold As Integer
            Dim UnitsInStock As Integer
            Dim fileStreamReader As IO.StreamReader
            Dim lineIn As String
            fileStreamReader = IO.File.OpenText("../../Clothes.txt")
    
            While Not fileStreamReader.EndOfStream
                lineIn = fileStreamReader.ReadLine()
                MsgBox(lineIn)
            End While
            fileStreamReader.Close()
    
    
        End Sub
    Any help would be appreciated.
    Thanks.
    Attached Images Attached Images  

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: WebBrowser control report application

    First, use Excel to Import and save as a TABLE, or create the DB and import the data
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: WebBrowser control report application

    Why can't you use .split? That would be the obvious choice here

    Also why do you say can use Mid() Len() and Instr() all of which are old VB functions rather than VB.Net which would be .Substring .Length and .IndexOf

    I would say use split on linein and that will give you your values in a string array


    Personally I would not use Excel at all, I would perhaps use a database and import the data into that or if the dataset is not to large I may consider using a class and a listof
    Also may consider just treating the text file as a data source for a data adapter or reader as needed.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Jan 2014
    Posts
    7

    Re: WebBrowser control report application

    that's what I need to do: just treating the text file as a data source. The problem is to pull out info of it and display as HTML table

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: WebBrowser control report application

    If you treat it as a data source then that means the data will be in fields, you just need to loop through your resulting reader and build your html from the data there. Should be pretty simple.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured