Link to home
Start Free TrialLog in
Avatar of PsiJet
PsiJet

asked on

Datagridview + HTML Tables (Visual Basic 2010 / VS 2010)

Okay, so I am baffled on this part and I don't know why (maybe because I had read through so many tutorials/threads in regards to this and confused myself).

I am trying to basically import a HTML page table (remotely accessed through a URL) to a Datagridview. I can view it as a pipe delimited.

Here is the HTML/pipe delimited: http://www.magictraders.com/cgi-bin/set_query.cgi?set=ABU&excel=true

So a rundown would be:

1. Import that information to a datagridview (DataGridView1)
2. Make sure all data is put into the appropriate column.

I know it's probably something super simple, but for some odd reason, as I stated above, the answer eludes me.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What kind of help are you looking for?

I can think of things like this:

1) Microsoft.VisualBasic.FileIO.TextFieldParser

2) Build a list of objects

3) Bind the list to the DataGridView

4) Set the DataPropertyName to each object property
Avatar of PsiJet
PsiJet

ASKER

Well I need to parse that data from the site above, taking out the information and then putting into a datagridview.

With a datagridview with the following headers:

Card Name | Rarity | High Price | Mid Price | Low Price

Using the example above:

Air Elemental (A)|3.25|0.00|3.25|3.25|3.25|0.00|1
Air Elemental (B)|4.97|0.02|4.97|4.99|4.95|0.00|2
Air Elemental (U)|7.00|0.00|7.00|7.00|7.00|0.00|1
Ancestral Recall (A)|697.77|0.00|697.77|697.77|697.77|0.00|1

The parts marked in bold are the parts that I want to parse into the columns. Would the TextFieldParser work for this? Either way I'll give it a try and update here.
The TextFieldParser can use the pipe as a delimiter, and since the first row has names, you should be able to match up the values to object names, and build a list that you can bind to the DataGridView.
ASKER CERTIFIED SOLUTION
Avatar of Vaughn Bigham
Vaughn Bigham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PsiJet

ASKER

Could you please provide an example? I'm a visual person. It doesn't need to be full code, but examples have always helped (especially since I've never used TextFieldParser).
Avatar of PsiJet

ASKER

vbigham: The only site I know of is through that site and they only do core sets and some expert sets (albeit the unglued/unhinged which I classify as special sets). The only other one that I know of uses a webservice, which I had issues with dealing with for some odd reason, but that's just me and my coding skills. LOL

I will check out your code and see what I can do with it. I thank you for the time! :)
Avatar of PsiJet

ASKER

Oh, vbigham:

You can use it if you view the source code on that websites main page and click on Price Guides. Since I've seen so many abbreviations for the sets:

Fifth Dawn - 5DN
Mirrodin - MRD

Just FYI. :)
Avatar of PsiJet

ASKER

(Stupid non-editing feature):

Okay, I re-read what you said and there are a LOT of sets.

Core Sets there are: Alpha, Beta, Unlimited, Revised, 4th-10th Edition, M10, M11 (from the site that I gave, abbreviations are: ABU, RV, 4th, 5th, 6th (etc to 10th), M10 and M11

Expert: To many to list, but the newest sets are Scars of Mirrodin, Mirrodin Besieged and New Phyrexia

Again, you can look at the source code from: http://www.magictraders.com/pricelists/

You'll see them in the Drop Down List.
Awesome! thanks for that info.