textbox to label

Thread Solved

Join Date: Feb 2009
Posts: 16
Reputation: dollmar is an unknown quantity at this point 
Solved Threads: 0
dollmar's Avatar
dollmar dollmar is offline Offline
Newbie Poster

textbox to label

 
0
  #1
Feb 17th, 2009
hello

my problem is simple but i cant solve it.
i have textbox in form1 and i want the value in the textbox equeal to the value in label in form2..how can i do it..

my code sample is:

form1.Text1.Text=form2.Label1.Caption

its not working...

anyone can help?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: textbox to label

 
0
  #2
Feb 17th, 2009
I guess you could put your entire project on here as a .zip file.... the code you have there, I see nothing wrong with. It is perfect.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 16
Reputation: dollmar is an unknown quantity at this point 
Solved Threads: 0
dollmar's Avatar
dollmar dollmar is offline Offline
Newbie Poster

Re: textbox to label

 
0
  #3
Feb 17th, 2009
this is my sample program:
Attached Files
File Type: zip sample.zip (2.7 KB, 5 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 102
Reputation: SCBWV is an unknown quantity at this point 
Solved Threads: 14
SCBWV SCBWV is offline Offline
Junior Poster

Re: textbox to label

 
1
  #4
Feb 17th, 2009
There is no caption in the label to retrieve.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: textbox to label

 
0
  #5
Feb 18th, 2009
aha! No Caption Set Yet!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 16
Reputation: dollmar is an unknown quantity at this point 
Solved Threads: 0
dollmar's Avatar
dollmar dollmar is offline Offline
Newbie Poster

Re: textbox to label

 
0
  #6
Feb 18th, 2009
What do you mean no caption?

i want to input data first in the textbox and automatically connect the inputted data in the label.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 65
Reputation: arvin2006 is an unknown quantity at this point 
Solved Threads: 4
arvin2006's Avatar
arvin2006 arvin2006 is offline Offline
Junior Poster in Training

Re: textbox to label

 
0
  #7
Feb 18th, 2009
Private Sub Form_Activate()
Form2.Label1.Caption = Form1.Text1.Text
End Sub
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: textbox to label

 
0
  #8
Feb 18th, 2009
*Point Above*

You were assigning the value of the caption to the textbox, not the other way around. You can do this:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim x
  2. x = 5
you cannot do this:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim x
  2. 5 = x
These are not interchangeable....It only works the first way. So when you put:
  1. form1.text1.text = form2.label1.caption
you are saying (with no exception) "I want text1 to now contain the data stored in label1".
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 13
Reputation: Ravi Kant is an unknown quantity at this point 
Solved Threads: 1
Ravi Kant's Avatar
Ravi Kant Ravi Kant is offline Offline
Newbie Poster

Re: textbox to label

 
1
  #9
Feb 18th, 2009
Give this code in Form1 :-

Private Sub Text1_Change()
Form2.Label1 = Text1.Text
End Sub
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 16
Reputation: dollmar is an unknown quantity at this point 
Solved Threads: 0
dollmar's Avatar
dollmar dollmar is offline Offline
Newbie Poster

Re: textbox to label

 
0
  #10
Feb 18th, 2009
thanks guys for your ideas and time analyzing my problem in visual basic..
thanks to comatose, arvin2006 and ravi kant..

thanks ravi kant...you have the exact solution to my program..

thanks again guys for all your commments..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC