473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VB and HTML

2
I have been wrestling with a problem for days. The solution is probably simple but i am not that experienced with html.
I have a vb program which sends info to a web page and as that page fills up a button is 'pressed' and the page is submitted, cleared and reloaded again.

To login to the site the code is as follows

oIE.Document.Forms("Login").All("district").Value = "district"
oIE.Document.Forms("Login").All("password").Value = password"
oIE.Document.Forms("Login").submit

then I navigate thru several pages via code to get where I need to go
then the code I use is basically this (with non essential info cut out)

N1 = "order.code"
N2 = "order.quantity"
While Not .EOF
For x = 0 To 9
If Not .EOF Then
oIE.Document.Forms(0).All(N1 & x).Value = ![Product No]
oIE.Document.Forms(0).All(N2 & x).Value = !Qty
.MoveNext
End If
If Err = 3021 Then Exit For
Next
While oIE.Busy: Wend
oIE.Document.Forms(0).submit

This works fine

So as you can see i am able to put info into forms where required. Now my problem. I have written new software that basically does the same thing but at a different site.
The login works fine but when the next page appears i am unable to enter any info into either of the 2 fields that are available

if i use the code
oIE.Document.Forms(0).All("Code").Value="1234" I get the error message
'Object variable or with block variable not set"
This is prolly because the forms(0) does not exist i think, although the form is there. I think i may need to access the document?

The html code is different for the input on this page also
On the first page the code reads
<input name="Password" type="password" id="Password" style="width:55px;" />

On the second page the code is;
<input id="SecurityCode" tabindex="1" name="SecurityCode" type="TEXT" value="" size="16" maxlength="6" />

so i do not know if there is a different way to pass a value to the "Input ID" field as opposed to the INPUT NAME field.

ANY help would be greatly appreciated as would some direction as to find out more about navigating or manipulating web pages from within VB. (events properties methods etc)

Many thanks in advance
Aug 31 '06 #1
1 2324
Tomy
1
Hi!

A few weeks ago i got the same problem when i needed to submit data to a webpage (GET request to download a file from server). So basicaly you dont need the code you wrote, you just need to comunicate with apache web server, i know it sounds quite "heavy" but its not so hard as it seems. Try google.com, it helped me :)

You need to send some header stuff. Here's a sample of how to get the index page from a server:
GET / HTTP/1.0
Host: microsoft.com
Content-Type: application/x-www-form-urlencoded

And Server's answer:

HTTP/1.1 302 Object moved
Connection: close
Date: Fri, 08 Sep 2006 20:36:41 GMT
Server: Microsoft-IIS/6.0
Level: T3
X-Powered-By: ASP.NET
Location: http://www.microsoft.com
Content-Length: 145
Content-Type: text/html
Set-Cookie: ASPSESSIONIDQACQBDBS=LFODKIDANLDBIJNJLAKBHBGB; path=/
Cache-control: private

+ Basic HTML

So basically, the web server telled us that we need to redirect to www.microsoft.com. The "Location: http://www.microsoft.com" tells us to do it.


In fact is much much simplier - you just send your data(username=blah-blah&password=sss) to a webpage through winsock and the server responds to your query e.g. "200 OK" and some header stuff. There's no need for running trough the code you wrote, just tell the webserver what to do and he will do it :)

I know i explained very bad and my language was just awfull, but im not american im Latvian, so forgive me for any mistakes i have made :)
Sep 8 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
0
by: Boris Ammerlaan | last post by:
This notice is posted about every week. I'll endeavor to use the same subject line so that those of you who have seen it can kill-file the subject; additionally, Supersedes: headers are used to...
9
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. ...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.