Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

Copy data from opened site and paste it to excel/database

$
0
0
Hello, im newbie here, and in programming too (big newbie..). Got a certain problem that can't solve alone, so i decided to write here =)

I was tried to make a "simple" calculator for certain site

http://poke-life.net/pokemon_skr.php?p=20891551

There is link for data that i wish to use in my calc to get it.

Attachment 98577

Right now it looks like at screen up. The entire idea was to copy values next to Hitpoints, Attack, Defense, Special Attack, Special Defense (Życie, Atak, Obrona, Specjalny Atak, Specialna Obrona). Those names are generated everytime at same place, but values can range from 2 to 3 digits.

Then it should paste them o excel/database and calc differences between "trained" one and "untrained" data from excel/database by Gatunek/Genre (in that example: Mankey).

I did it for OpenOffice as Calc sheet but i wish to make almost same idea for stand-alone program that not require OpenOffice/Excel installed.
Code:

http://speedy.sh/z5ejF/PokelifeCalc.ods
(example of Calc idea).


So far i did:

Code:

Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            If InStr(1, LCase(TextBox1.Text), "http://poke-life.net/pokemon_skr.php?p") <> 0 Then
                WebBrowser1.Navigate(TextBox1.Text)
            End If
        End If
    End Sub

For TextBox1, only sites with certain string are allowed

Code:

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        WebBrowser1.Document.ExecCommand("SelectAll", True, vbNull)
        WebBrowser1.Document.ExecCommand("Copy", True, vbNull)
        Text1.Paste()
        WebBrowser1.Document.ExecCommand("Unselect", True, vbNull)

    End Sub

WebBrowser1 - select all visible data, copy that, paste to text1 then unselect data.
AND there is my first thing i want to change - it should catch data from opened tab/website, then copy it and paste automaticaly (just like example above, but without WebBrowser formula). Im not sure if it is even possible, or how to do that.


So after copy that data it should paste them to excel/database, to certain positions (so no new strings every time it copy, just overwrite old one). With next step (calculating new data based on pasted one + modified by other data values etc) i can handle with no problem. But the second problem is returning new data (IE: old data are in A1-D5 cells, new data are in A10-D15 cells). How to read certain cell/position and return it to set position at my form (so like returning value from A10 to TextBoxA10).


I mess here with trash information im sure, also as you see im total newbie at programming even simple things. But really want to help other people with that calculator (so they will be not scammed by others).
Attached Images
 

Viewing all articles
Browse latest Browse all 42225

Trending Articles