In C#, unlike java we do not have to use any method. TextBox property Text is used to get or set its text. Get string username = txtusername.Text; string password = txtpassword.Text; Set txtusername.Text = "my_username"; txtpassword.Text = "12345";