What is the correct syntax

I have this code
1- FormLogin

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Organization_Manager.Pal.Forms
{
    public partial class FormForgotPassword : Form
    {
        private string sql = @"Data Source =  .\SQLEXPRESS;
                             Initial Catalog = Organization_Manager;
                             Integrated Security = True;";

        public FormForgotPassword()
        {
            InitializeComponent();
        }
        private bool IsValidEmail(string email)
        {
            try
            {
                var addr = new MailAddress(email);
                return addr.Address == email;
            }
            catch 
            {
                return false;
            }
        }

        private void pictureBoxClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void pictureBoxClose_MouseHover(object sender, EventArgs e)
        {
            toolTip1.SetToolTip(pictureBoxClose, "Close");
        }

        private void textBoxEmail_Enter(object sender, EventArgs e)
        {
            if (textBoxEmail.Text.Trim() == "abdu@gmail.com")
            {
                textBoxEmail.Clear();
                textBoxEmail.ForeColor = Color.Black;
            }
            if (!IsValidEmail(textBoxEmail.Text.Trim()) || textBoxEmail.Text.Trim() == "abdu@gmail.com")
                pictureBoxError.Show();
            else
                pictureBoxError.Hide();
        }

        private void textBoxEmail_Leave(object sender, EventArgs e)
        {
            if (textBoxEmail.Text == string.Empty)
            {
                textBoxEmail.Text = "abdu@gmail.com";
                    textBoxEmail.ForeColor = Color.DarkGray;
            }
            if (!IsValidEmail(textBoxEmail.Text.Trim()) || textBoxEmail.Text.Trim() == "abdu@gmail.com")
                pictureBoxError.Show();
            else
                pictureBoxError.Hide();
        }

        private void pictureBoxError_MouseHover(object sender, EventArgs e)
        {
            toolTip1.SetToolTip(pictureBoxError, "invalid Email!");
        }

        private void buttonVerify_Enter(object sender, EventArgs e)
        {
            if(IsValidEmail(textBoxEmail.Text.Trim()))
            {
                
                string UserName = Organization.Organization.GetUserNamePassword("SELECT User_Name from User_Table where User_Email = '" + textBoxEmail.Text.Trim() + "'; ", Sql);
                string password = Organization.Organization.GetUserNamePassword("SELECT User_Pass from User_Table where User_Email = '" + textBoxEmail.Text.Trim() + "'; ", Sql);
                MessageBox.Show(" Your User Name is " + UserName + " and Pssword is" + password + ".", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }

        private void FormForgotPassword_load(object sender, EventArgs e)
        {
            pictureBoxError.Hide();
        }
    }
}

2- ForgotPassword

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Organization_Manager.Pal.Forms
{
    public partial class FormForgotPassword : Form
    {
        private string sql = @"Data Source =  .\SQLEXPRESS;
                             Initial Catalog = Organization_Manager;
                             Integrated Security = True;";

        public FormForgotPassword()
        {
            InitializeComponent();
        }
        private bool IsValidEmail(string email)
        {
            try
            {
                var addr = new MailAddress(email);
                return addr.Address == email;
            }
            catch 
            {
                return false;
            }
        }

        private void pictureBoxClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void pictureBoxClose_MouseHover(object sender, EventArgs e)
        {
            toolTip1.SetToolTip(pictureBoxClose, "Close");
        }

        private void textBoxEmail_Enter(object sender, EventArgs e)
        {
            if (textBoxEmail.Text.Trim() == "abdu@gmail.com")
            {
                textBoxEmail.Clear();
                textBoxEmail.ForeColor = Color.Black;
            }
            if (!IsValidEmail(textBoxEmail.Text.Trim()) || textBoxEmail.Text.Trim() == "abdu@gmail.com")
                pictureBoxError.Show();
            else
                pictureBoxError.Hide();
        }

        private void textBoxEmail_Leave(object sender, EventArgs e)
        {
            if (textBoxEmail.Text == string.Empty)
            {
                textBoxEmail.Text = "abdu@gmail.com";
                    textBoxEmail.ForeColor = Color.DarkGray;
            }
            if (!IsValidEmail(textBoxEmail.Text.Trim()) || textBoxEmail.Text.Trim() == "abdu@gmail.com")
                pictureBoxError.Show();
            else
                pictureBoxError.Hide();
        }

        private void pictureBoxError_MouseHover(object sender, EventArgs e)
        {
            toolTip1.SetToolTip(pictureBoxError, "invalid Email!");
        }

        private void buttonVerify_Enter(object sender, EventArgs e)
        {
            if(IsValidEmail(textBoxEmail.Text.Trim()))
            {
                
                string UserName = Organization.Organization.GetUserNamePassword("SELECT User_Name from User_Table where User_Email = '" + textBoxEmail.Text.Trim() + "'; ", Sql);
                string password = Organization.Organization.GetUserNamePassword("SELECT User_Pass from User_Table where User_Email = '" + textBoxEmail.Text.Trim() + "'; ", Sql);
                MessageBox.Show(" Your User Name is " + UserName + " and Pssword is" + password + ".", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }

        private void FormForgotPassword_load(object sender, EventArgs e)
        {
            pictureBoxError.Hide();
        }
    }
}

coming with these errors

1 Like

I don’t think your accessing the namespace that you want to use