Link to home
Start Free TrialLog in
Avatar of xrosem
xrosem

asked on

Pass information from winform to webform to display info on webform.

Is there a way in visual basic .net to pass information from a windows form to a webform when a user clicks a button on the winform. I need to send the correct data to the webform to display information that pertains to the winform. I appreciate any help in this matter, thanks.

Mike
Avatar of ptakja
ptakja
Flag of United States of America image

Do you want to populate fields on a web form, or click a button on the WinForm and have the browser open up to a specific page where you can extract data?

IF the latter, you can use QueryStrings to pass the info:

In your WINFORM app when the button is clicked:

Dim URL as string = String.Format("http://www.mywebsite.com/MyPage.aspx?Data1={0}&Data2={1}", 190, "catalog")
Process.Start(URL)  'Kick off default browser to URL listed.

In this example, your default browser would open to the page specified.

Then in your WebForm page named "MyPage.aspx" you would have some code to pull the QueryString data:

Data1 = 190
Data2 = "catalog"

from this then you can fill fields on the form, or perform db lookups, etc...
Avatar of xrosem
xrosem

ASKER

I would like the winform to popluate the webform fields.
Avatar of xrosem

ASKER

On the later part where you click a button on the winform how does that code give the webform the information.

Dim URL as string = String.Format("http://www.mywebsite.com/MyPage.aspx?Data1={0}&Data2={1}", 190, "catalog")
Process.Start(URL)  'Kick off default browser to URL listed.

Is data1 and data2 string variables and they get passed? Then you reference the variables on the webform when it is open?
 
I appreciate your help.
Avatar of xrosem

ASKER

It states that process is not declared. What  do i need to declare it as to get the page to fire? Or what is the process.start?
ASKER CERTIFIED SOLUTION
Avatar of ptakja
ptakja
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
Sorry...the Process object is part of System.Diagnostics

So either add "Imports System.Diagnostics" outside your class or explicitly call it out as:

System.Diagnostics.Process.Start(blah blah)
The "?" after the page name tells the the URL parser that there are query strings in the URL. That is what populates the Request Object's Querystring collection.
Avatar of xrosem

ASKER

ptakja, thanks it worked great. You are truly awsome!!! Thanks a bunch.

Mike