Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello every body
pleeeeeeeease Please help me . I have problem in c#.net.
I have 3 forms,1 textbox in form1,1 textbox in form2.
In form3: i want to have a print button to print the text of textboxes in form1 & form2

pleeeeeease Please help me I'm new in C# please explain your answer tnx thanks a lot.
Posted
Updated 31-Jul-12 20:02pm
v3
Comments
pradiprenushe 1-Aug-12 2:00am    
How are you navigating in form? Means when you entering text on first form, second form, when you click button? Give sequence how you are going to handle it?
pradiprenushe 1-Aug-12 2:05am    
I think you have already posted question. Dont post it twice.

Declare a static string in Form1;

In Form1
C#
public static string SetValueForTextBox1 = "";


and in button click;
SetValueForTextBox1 = textBox1.Text;



similaarly declare another static variable in Form2
C#
public static string SetValueForTextBox2 = "";


and in button click;
C#
SetValueForTextBox2 = textBox1.Text;



and in the form3 on Printbuttonclick, You can get the textbox values from FOrm1 and form2 like,

C#
Form1.SetValueForTextBox1 ;
Form2.SetValueForTextBox2 ;
 
Share this answer
 
v2
Comments
siasalar 1-Aug-12 2:37am    
thank you very muuuuuuuuuuuuuuuch its working.
thank you maaaan thank you best wishes for you.
Santhosh Kumar Jayaraman 1-Aug-12 2:39am    
Can you mark it as solved/accepted answer, so that other people will know the answer
siasalar 1-Aug-12 2:45am    
certainly,i marked it dear.
Unareshraju 1-Aug-12 3:33am    
i also learned new one .thank u santhosh
hi siasalar,

by using print dialog box we can get the print.


see the below url, i hope this achieves u r requirement.
http://msdn.microsoft.com/en-us/library/aa969773.aspx[^]

http://www.dreamincode.net/forums/topic/50924-use-a-print-dialog-box-to-print-contents-of-a-textbox/[^]
 
Share this answer
 
Comments
siasalar 1-Aug-12 2:19am    
tnx alot for responsibility
i dont know how can i access to textbox.tex in another forms with print dialog box.
if you know please explain it to me.
Hi,

Create property for storing the value in form1 and form2
public static class Utility
{
public static string ValueForm1;
public static string ValueForm2;

public static string valueForm1
{
get { return ValueForm1; }
set { ValueForm1 = value; }
}

public static string valueForm2
{
get { return ValueForm2; }
set { ValueForm2 = value; }
}
}
Store value in this property from form1 and form2 and call this ValueForm1 ,ValueForm2 on the form3.
 
Share this answer
 
Comments
siasalar 1-Aug-12 4:33am    
tnx dear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900