dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersRaj.Trivedi
Minu
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » Windows »

How to pass value from one application to another application


Posted Date: 12 Jul 2012      Posted By:: umesh     Member Level: Gold    Member Rank: 632     Points: 2   Responses: 7



How to pass value from one application to another application

I have an application in which i have a button while clicking on that button another application should be opened and some value from application 1 should be passed to application 2




Responses

#680038    Author: jogesh      Member Level: Gold      Member Rank: 229     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 0

Use querystring...

To Write...
HttpContext.Current.Request.QueryString["value"] = value;


To read value in another application...
string value = HttpContext.Current.Request.QueryString["value"];



 
#680040    Author: Anil Kumar Pandey      Member Level: Platinum      Member Rank: 1     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

You can make use of either a common database where the value can be stores and the other application can read it or else you can make use of a common file where both the application can read and write information.

Thanks & Regards
Anil Kumar Pandey
Microsoft MVP, DNS MVM



 
#680077    Author: Ajatshatru Upadhyay      Member Level: Gold      Member Rank: 20     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

Hi,

It is not possible to invoke entire application. If you want to do it, you have to use technology like web services. By using web services, you can call some method (web method) of another application and pass input(s) and can get processed output.

Hope it'll help you.
Regards
Ajatshatru






 
#680096    Author: Paritosh Mohapatra      Member Level: Diamond      Member Rank: 6     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

Use a global class file to get and set the values.

Please check the following code:

Class1.cs
---------


class Class1
{
static string FirstName;
static string LastName;
static string EMail;
public static string GetFirstName()
{
return FirstName;
}
public static string GetLastName()
{
return LastName;
}
public static string GetEmail()
{
return EMail;
}

public static void SetData(string fname, string lname, string em)
{
FirstName = fname;
LastName = lname;
EMail = em;
}
}


In Form1, you can set the values of the TextBoxes using the following code:


private void button1_Click(object sender, EventArgs e)
{
Class1.SetData(textBox1.Text, textBox2.Text, textBox3.Text);
}

private void button2_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.Show();
}


In Form2, you can get the data using the following code:


private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = Class1.GetFirstName();
textBox2.Text = Class1.GetLastName();
textBox3.Text = Class1.GetEmail();
}



Thanks & Regards
Paritosh Mohapatra
Microsoft MVP (ASP.Net/IIS)
DotNetSpider MVM



 
#680146    Author: Ultimaterengan        Member Level: Gold      Member Rank: 9     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

<h4>
You can pass values from one page to another page by using query string.</h4>

var vquery = window.location.search.substring(1);
alert(vquery);


<U><H3>In First Page:-</H3></U>




<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Passing Query String Values between pages</title>

<script type="text/javascript" language="javascript">
function PassQueryStringValue()
{
var vQueryStringVal = "Welcome";
alert("DisplayQueryString.aspx?Qid=" + vQueryStringVal+"&dotnetspider");
window.open("DisplayQueryString.aspx?Qid=" + vQueryStringVal+"& Qid1=dotnetspider");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="PassQueryStringValue();" />
</div>
</form>
</body>
</html>

<H4>
To get the Query string value we can use GetQueryStringValue </H4>

<U><H3>In Second Page:-</H3></U>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function GetQueryStringValue()
{

var vquery = window.location.search.substring(1);

var vparms = vquery.split('&');

for (var i=0; i <vparms.length; i++)

{

var vpos = vparms[i].indexOf('=');

if (vpos > 0) {

var vkey = vparms[i].substring(0,vpos);

var vval = vparms[i].substring(vpos+1);

alert(vval);

}

}

}

</script>
</head>
<body onload="GetQueryStringValue()">
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>





Thanks & Regards
G.Renganathan
Nothing is mine ,Everything is yours!!!


http://renganathan1984.blogspot.com/



 
#680149    Author: Ultimaterengan        Member Level: Gold      Member Rank: 9     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

This is windows application

How to pass value from one form to another form using windows applicaiton.
Step 1:-
Click File-->New-->Project then click new project window will display
and choose vb.net or c# then give name to it.

Step 2:-
Right click the project name and click Add -->Windows form

Step 3:-

In Form 1 just drag and drop one button and textbox control.In button click event just create the object for form2.

Step 4:-
Just drag and drop one textbox control to show the form1 textbox value and click the textbox then go to the property window change the property of modifiers to public(Default is private).

Take the below code and check it.

C# Code


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.textBox1.Text = textBox1.Text.ToString();
f2.Show();
}
}
}



VB.Net Code


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f2 As New Form2
f2.TextBox1.Text = TextBox1.Text
f2.Show()
End Sub
End Class



Thanks & Regards
G.Renganathan
Nothing is mine ,Everything is yours!!!


http://renganathan1984.blogspot.com/



 
#680154    Author: Rameshwar      Member Level: Silver      Member Rank: 622     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

Dear Umesh,

The solution for passing value from one application to another is that you will have to use unique data base and use the data for both application. So that your problem is solve.

I think this will help you.


Regards
Rameshwar



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Add textbox control to datagridviewcell
Previous : How to Run an exe from windows service
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.