Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

vb form data to internet explorer?

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
tejaspurani
Asked:
tejaspurani
  • 6
  • 5
  • 3
  • +4
1 Solution
 
gencrossCommented:
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
 
hesCommented:
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
 
hesCommented:
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!

 
tejaspuraniAuthor Commented:
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
 
hesCommented:
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
 
tejaspuraniAuthor Commented:
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
 
AzraSoundCommented:
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
 
tejaspuraniAuthor Commented:
AzraSound,

still confuse , can u send me sample code.

T.P.
0
 
AzraSoundCommented:
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
 
tejaspuraniAuthor Commented:
where do i see the mypage.asp

T.P.
0
 
alicelknightCommented:
tejaspurani:

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

Alice
0
 
alicelknightCommented:
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
 
alicelknightCommented:
0
 
alicelknightCommented:
0
 
alicelknightCommented:
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
 
alicelknightCommented:
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
 
tejaspuraniAuthor Commented:
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
 
DanRollinsCommented:
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
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now