Solved

vb form data to internet explorer?

Posted on 2002-06-18
19
398 Views
Last Modified: 2010-05-02
I have a vb form which get large data from user.
I need a code which opens an Internet Explorer browser
from that vb form and retrive the data on IE browser.

I can not use shell execute method of vb and pass data as
querystring.

I need some kind of logic to pass data so I can retrive it
on asp page as request.form() collection.

T.P.
0
Comment
Question by:tejaspurani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +4
19 Comments
 
LVL 4

Expert Comment

by:gencross
ID: 7089881
You should be able to use the MS HTML Document Object Model with the IE controls to load a page, parse it, make changes, load data, etc...

I know this is very vague, but it may get you on the right track.  I have not worked with the objects enough to provide with specific examples in a short amount of time:)
0
 
LVL 20

Expert Comment

by:hes
ID: 7089938
Try this
Dim WithEvents Web1 As InternetExplorer
Dim comp2 As Boolean
Dim sHtml As String
Option Explicit

Where you want to open the browser
Set Web1 = New InternetExplorer
  Web1.Visible = True

  Web1.Navigate "http://www.experts-exchange.com/jsp/qPowerSearch.jsp", 12
  comp2 = False
  Do Until comp2 = True
    DoEvents
  Loop
sHtml = Web1.Document.documentElement.innerHTML
' sHtml now contains the webpage that you can parse


Private Sub Web1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
  comp2 = True
End Sub
0
 
LVL 20

Expert Comment

by:hes
ID: 7089940
Almost forgot set a reference in your project to Microsoft Internet Controls
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:tejaspurani
ID: 7090045
hes,

I didn't get it.
via web1.navigate "url" i can open the new page
but how to pass the variable and retrive it on that page.

T.P.
0
 
LVL 20

Expert Comment

by:hes
ID: 7090070
Look up the name of the field on the web page then use something like this (this is used to login to EE)

Web1.Navigate2 "http://www.experts-exchange.com", 12
Do Until Comp2 = True
  DoEvents
Loop

Web1.Document.All("loginMemberName").Value = UserId
Web1.Document.All("loginPassword").Value = Password
Web1.Document.Forms(0).submit
Comp2 = False
Do Until Comp2 = True
  DoEvents
Loop
0
 
LVL 3

Author Comment

by:tejaspurani
ID: 7090081
I need something like this, here I 'm retriving the data via request.querystring().
I need code to retrive the variable via request.form()

Private Declare Function ShellExecute Lib _
     "shell32.dll" Alias "ShellExecuteA" _
     (ByVal hWnd As Long, ByVal lpOperation _
     As String, ByVal lpFile As String, ByVal _
     lpParameters As String, ByVal lpDirectory _
     As String, ByVal nShowCmd As Long) As Long
     
     
Sub Main()
    On Error GoTo err:
    Dim somevariable as string
    somevariable = "data"
    strIE = "http://localhost/default.asp?item=somevariable"

    ShellExecute 0&, vbNullString, strIE, vbNullString, _
    vbNullString, SW_SHOWNORMAL
    End
    Exit Sub
err:
    If err.Number > 0 Then
        MsgBox err.Number & err.Description
    End If
End Sub

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7091241
You cant get there with ShellExecute...use the InternetExplorer object as shown above and implement code similar to the following:

"HOWTO: Use the PostData Parameter in WebBrowser Control (Q174923)"
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q174923

Alternatively, this can also be achieved via the Inet control and XML Parser library.  Unless you need either of those two controls for anything else, I would stick with the Internet Explorer implementation so you do not have to distribute any additional components.
0
 
LVL 3

Author Comment

by:tejaspurani
ID: 7103789
AzraSound,

still confuse , can u send me sample code.

T.P.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7104510
Dim IE
Dim strPostData As String


strPostData = "name=me&this=that"
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.mysite.com/mypage.asp", 0, "", StrConv(strPostData, vbFromUnicode), "Content-Type: application/x-www-form-urlencoded" & vbCrlf


Your posted data should take on the typical look of data being posted to your server using your form input names (as you might use in Request.Form()) along with their values.
0
 
LVL 3

Author Comment

by:tejaspurani
ID: 7163125
where do i see the mypage.asp

T.P.
0
 

Expert Comment

by:alicelknight
ID: 7163148
tejaspurani:

Hold on a bit.  I may be able to help.

Alice
0
 

Expert Comment

by:alicelknight
ID: 7163158
tejaspurani

Go here:
mk:@msitstore:\\dev\msdn\msdn\techart.chm::/html/msdn_vbhttp.htm

I used these functions and followed the examples to post to an asp page and get the return values.

Alice
0
 

Expert Comment

by:alicelknight
ID: 7163265
tejaspurani:

AzraSound gives a good example.  This appears to be less complicated than how I had to do it as I could not open any browers.  I used VB's API's for http.  Since I see you have to open IE, etc, I would go his route.  If you are confused about the parameters, go to msdn, they have a lot of good explanations.

Azra:  Sorry, I did not see your comment.

Alice
0
 

Expert Comment

by:alicelknight
ID: 7163548
tejaspuani:

Hi again...(from other question I posted)....
I've read this question and all comments.  I believe that your best solution is hess or AzraSound.  Although I had to do the same thing, my situation was a bit different from yours.  I can send you what I have, but it is a class of WinInet functions that you call and pass parameters, much like what AzraSound is showing you.  I did not have to open any browser and send values.  

Alice
0
 
LVL 3

Author Comment

by:tejaspurani
ID: 7165101
Hi Azra,alice
I 'm trying to run this example but he data didn't showup in the page .... any clue?

'vb code
    Dim IE
    cFlavor = "Test" 'cboFlavor.Items(cboFlavor.SelectedIndex)
    cParamFlavor = "Flavor="
    cSeparator = "&"
    cParamName = "FName="

    cPostData = cParamName & "Value" & cSeparator & cParamFlavor & cFlavor

    vHeaders = "Content-Type: application/x-www-form-urlencoded" + Chr(10) + Chr(13)

    'Convert the string to post to an array of bytes.
    'vPost = ASCIIEncoding.ASCII.GetBytes(cPostData)
    vPost = StrConv(cPostData, vbFromUnicode)
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
    'IE.Navigate "http://getPostData/default.asp", 0, "", StrConv(strPostData, vbFromUnicode), "Content-Type: application/x-www-form-urlencoded" & vbCrLf
    IE.Navigate2 "http://getPostData/default.asp", 0, "", vPost, vHeaders

'asp code
<%
      cFlavor = Request("Flavor")
      cName = Request("FName")
%>
      <BODY>
      Hello, <% =cName %>.
      One scoop of <% =cFlavor %> coming right up!
      </BODY>

thanks in advance
T.P.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7911178
Hi tejaspurani,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

tejaspurani, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7967854
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month5 days, 3 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question