.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

transfer value from one form to another

Posted By: Naresh     Posted Date: December 16, 2009    Points:2   Category :VB.Net
transfer textbox value from one form to another in vb.net windows application

Responses
Author: Amit Mehra             
Posted Date: December 16, 2009     Points: 5   

Hi Malathy,

There are many ways you can transfer value from one form to another

Method 1: Using Constructor overload

For example if you ware passing value from Form1 to Form2 than try like this

1st overload the Form2 Constructor

Form1(string Name)

Now while calling the form2 from Form1

Form2 frm2 = new Form2(TextBox1.Text);// here we are passing the value
frm2.ShowDialog()


Method 2: Using Property

Declare property in Form2 like this

private string m_Name = string.Empty
Public string Name
{
Set
{
Name = value;
}
}


Now you can assign the value from Form1 while calling Form2

Like this

Form2 frm2 = new Form2();
frm2.name = textBox1.text;// here we are passing the value to Form2
frm2.ShowDialog()


Hope this will help you

Thanks
Amit

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Naresh             
Posted Date: December 16, 2009     Points: 5   

hi amit,
thanks for ur reply.

Thanks
Naresh
Author: Amit Mehra             
Posted Date: December 16, 2009     Points: 5   

You are welcome Malathy

Sorry the above example is in C#, you can convert it to Vb.Net.
Thanks
Amit

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Naresh             
Posted Date: December 16, 2009     Points: 5   

yah i converted. byee thanku

Thanks
Naresh
Author: nishithraj             
Posted Date: December 18, 2009     Points: 5   

check the following url
http://www.tek-tips.com/faqs.cfm?fid=5773



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend