Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i m setting textbox.text property from another class using public property of first class that contains the textbox but it is throwing object reference not set to an instance of object...any solution?
Posted
Comments
Prerak Patel 26-Sep-11 4:41am    
Share code.

Make sure the textbox (and form) has actually been instantiated before setting it to a value.
 
Share this answer
 
Comments
Tech Code Freak 26-Sep-11 5:36am    
Exactly! 5up!
Abhinav S 26-Sep-11 7:04am    
Thanks.
P.Salini 26-Sep-11 5:42am    
My 5!
Abhinav S 26-Sep-11 7:04am    
Thank you.
your first class is not initialized.
so the property is nothing of the first class


object reference not set to an instance of object error is fired generally when you try to assign a value to null reference.
 
Share this answer
 
got resolved as i pass the actual reference by sending (this) as method arguemnt and using that reference in second class.
 
Share this answer
 

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