how to get form form1.textbox1.text in class

tiwana22

New member
Joined
Aug 31, 2018
Messages
4
Programming Experience
Beginner
Hi guys, i need a help to get form1.textbox1.text in Class to make a registry entry : below is the code, i am using for it :

C#:
Microsoft.Win32.Registry.CurrentUser.CreateSubKey("MyTestKey");

Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyKey\\Registration", "Code", [COLOR=#ff0000][B]form1.textbox1.Text[/B][/COLOR]);

but it did not pick the value from textbox.

PS : I also tried to disable form1.button1 through class with this coding : form1.Button1.Enabled = true;
but it also does not work.
please help, how can i do it.
 
Last edited:
Does that form create the instance of the class containing that code? If so then the form should be passing that data into that object. That's done the same way as always, i.e. by setting a property or passing an argument to a method, which could be a constructor or any other method.
 
Back
Top Bottom