Question: What am I doing wrong? I get this error: The name 'LoginPasswordUserControl' does not exist in the current context I have a user control, here

What am I doing wrong?

I get this error:

"The name 'LoginPasswordUserControl' does not exist in the current context"

I have a user control, here is the code:

using System.Windows.Forms; //Define the namespace to make the user control. //namespace to hold the application namespace LoginPasswordUser { //Define the class to make the user control. //Class to define the control public partial class LoginPasswordUserControl : UserControl { //Define the read-only properties to get the username and the password from the user control. //Define the property for the username. //property to read username public string Login { get { return loginTextBox.Text.Trim(); } } // Define the property for the password. //property to read password public string Password { get { return passwordTextBox.Text.Trim(); } } //Define the constructor to initialize the GUI of the user control. /* Constructor to initialize the user control */ public LoginPasswordUserControl() { InitializeComponent(); } } }

I also have my main class, here is that code:

namespace testing { //Define the class to make the application. //class to define the form public partial class LoginForm : Form { //Define the constructor to initialize the GUI of the form. /*Constructor to initialize the GUI of the form */ public LoginForm() { InitializeComponent(); } //Define the Click event of the button to process the username and the password. /* Method to define the Click event of the Button */ private void btnGetDetails_Click(object sender, EventArgs e) { //Get the value of the username and password fields in the strings. //get the username and password string uName = LoginPasswordUserControl.Login; string pWord = LoginPasswordUserControl.Password; //Get a new string by concatenating the username and the password. //make a single string from the username and //password string logDetail = "User Name: " + uName + " Password is: " + pWord; //Show the username and the password in the new MessageBox. //show the details in a //MessageBox MessageBox.Show(logDetail, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }

PLEASE HELP!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!