-
Apr 14th, 2011, 08:53 PM
#1
Thread Starter
New Member
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”
-
Apr 14th, 2011, 09:15 PM
#2
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
-
Apr 14th, 2011, 09:41 PM
#3
Thread Starter
New Member
Re: I am trying to find a value in a dynamic web table
Thank you this is my first attempt at posting here
-
Apr 14th, 2011, 11:52 PM
#4
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.
-
Apr 15th, 2011, 11:03 AM
#5
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.
-
Apr 15th, 2011, 08:27 PM
#6
Thread Starter
New Member
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
-
Apr 16th, 2011, 07:18 AM
#7
Re: I am trying to find a value in a dynamic web table
But you're missing 99.9% 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|