Results 1 to 7 of 7

Thread: I am trying to find a value in a dynamic web table

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Red face I am trying to find a value in a dynamic web table

    The original problem I need to solve:
    Here is a hypothetical example which I would like to ask you to demonstrate two alternatives for coding:

    A web table has a dynamic number of rows and columns and there is a "X" somewhere in one of the cells in the table
    1. Write the code to return the "X"
    2. Write the code to return the position of the "X"
    The code can either be pseudo-code or real code (using Vb, ).

    I will need comments that explain what each line of code is doing in great detail for the task the exercise above is what I need a solution to.

    My thoughts on this problem
    I am looking for Ideas here. Problem:
    let’s say the value is “X”.
    I need to return the position of “X” and then Return the X.
    I need the VB Code that finds a value lets say it is “X” and is located in a dynamic web table that has a dynamic number of rows and coulombs.
    I need the VB code that returns the position of X
    I need the VB code to return the “X”

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: I am trying to find a value in a dynamic web table

    I have reported the duplicate thread.


    [Duplicate removed — Mod]
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Re: I am trying to find a value in a dynamic web table

    Thank you this is my first attempt at posting here

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: I am trying to find a value in a dynamic web table

    There's no generic coding solution for this type of exercise since you're at the mercy of whoever wrote the code to create the Table.

    A methodology to adopt might be something like this:

    1. Open up the Page using the WebBrowser control
    2. Using the Document object, parse the html looking for the appropriate <Table> tag
    3. Having found that, look for the next <TR> tag, and increment a counter for the row number
    4. Having found that, look for the next <TD> tag, increment a Column counter and examine the contents between that and the next </TD> or </TR> tag, if it's 'X' then save the value and the row and column counters, and exit the loop.
    5. if the contents were'nt 'X' then go back to 3 above.
    6. Continue until you find a </Table> tag.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: I am trying to find a value in a dynamic web table

    Should we assume "position" of X means the row and column it is in?

    This reads like requirements for a class assignment. As such there is probably a narrowly defined range of HTML involved, such as the most simple of HTML pages where the body contains one table with no gingerbread like THEAD/TFOOT elements or colspan attributes.

    If so, providing the template that is part of the assignment will help get to an answer. But note that such simple cases rarely exist in the wild.

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Re: I am trying to find a value in a dynamic web table

    Thanks for your replies this is what I have so far

    Pseudo code:::::

    For row = 1 to rowsize :: A loop to count rows
    For col = 1 to colsize :: A loop to count columns
    If box(x,y).value ="x" then :: Test
    Print "Box" row ", " col "has value " box(x,y).value
    :: Show user results
    end if :: end conditional
    end for loop :: col
    end for loop :: row

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: I am trying to find a value in a dynamic web table

    But you're missing 99.9&#37; of the code and only have the 0.1% of the most trivial code there.

    The trick is building your "Box" array from HTML input.

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