thejobe
thejobe
CC#
Created by thejobe on 4/9/2024 in #help
Installing an App to unlock USB debugging
Tried that and it blocks the screen with a static picture of the logo.
4 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
yes I was able to resolve the issue. Thank you for your help
20 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
hey Ero. I tried it with newUser = new createuser(); and there is no context for it to work. would I have to create the variable of newUser first for it to work? but then it wouldnt be a class object anymore. right?
20 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
Ahhh ok I see. I will have to work on this. Thanks. Do you see any other issues I might run into with the structure I have now?
20 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
Wait that is local? So how do i make it usable elsewhere? I thought this is how you create the class object.
20 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
Oh I think visual studio did that as a potential fix one time. Forgot it was there. Is that the issue?
20 replies
CC#
Created by thejobe on 3/21/2023 in #help
✅ object reference not set to an instance of an object (beginner)
Second page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StartMenu
{
internal class createuser
{
private string userName { get; set; }
private string password { get; set; }



public createuser()
{

Console.WriteLine("Hello welcome to the register system");
Console.WriteLine("Please enter your user name");
userName = Console.ReadLine();
createpassword();
}

public static void Login(createuser newUser)
{

string userinput;
string passwordinput;

Console.WriteLine("Hello. To login please enter your username.");
userinput = Console.ReadLine();
Console.WriteLine("Please enter your password.");
passwordinput = Console.ReadLine();

if (userinput == newUser.userName && passwordinput == newUser.password)
{
Console.WriteLine($"System access granted. Hello {newUser.userName}");
}
else if(userinput == newUser.userName && passwordinput != newUser.password)
{
Console.WriteLine("Incorrect password.");
}
else
{
Console.WriteLine("Sorry that user does not exist");
}

}


private void createpassword()
{
Console.WriteLine("Please enter a password.");
password = Console.ReadLine();
Console.Clear();
string newpassword = new string('*', password.Length);
Console.WriteLine($"Your Username: {userName}");
Console.WriteLine($"Your password: {newpassword}");
Console.WriteLine("Please press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.mainMenu();

}

public static void changePass(createuser newUser)
{
Console.WriteLine("please type your old password.");
var passcha = Console.ReadLine();
if (passcha == newUser.password)
{
Console.WriteLine("Please type your new Password");
string newpass = Console.ReadLine();
newUser.password = newpass;
Console.WriteLine($"Your new password is {newUser.password}");
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.userMenu();
}

}

public static void userInfo(createuser newUser)
{

string newpassword = new string('*', newUser.password.Length);
Console.WriteLine($"Your User Name is: {newUser.userName}");
Console.WriteLine($"Your Password is: {newpassword}");
Console.WriteLine("Press any Key to return to menu.");
Console.ReadKey();
}


}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StartMenu
{
internal class createuser
{
private string userName { get; set; }
private string password { get; set; }



public createuser()
{

Console.WriteLine("Hello welcome to the register system");
Console.WriteLine("Please enter your user name");
userName = Console.ReadLine();
createpassword();
}

public static void Login(createuser newUser)
{

string userinput;
string passwordinput;

Console.WriteLine("Hello. To login please enter your username.");
userinput = Console.ReadLine();
Console.WriteLine("Please enter your password.");
passwordinput = Console.ReadLine();

if (userinput == newUser.userName && passwordinput == newUser.password)
{
Console.WriteLine($"System access granted. Hello {newUser.userName}");
}
else if(userinput == newUser.userName && passwordinput != newUser.password)
{
Console.WriteLine("Incorrect password.");
}
else
{
Console.WriteLine("Sorry that user does not exist");
}

}


private void createpassword()
{
Console.WriteLine("Please enter a password.");
password = Console.ReadLine();
Console.Clear();
string newpassword = new string('*', password.Length);
Console.WriteLine($"Your Username: {userName}");
Console.WriteLine($"Your password: {newpassword}");
Console.WriteLine("Please press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.mainMenu();

}

public static void changePass(createuser newUser)
{
Console.WriteLine("please type your old password.");
var passcha = Console.ReadLine();
if (passcha == newUser.password)
{
Console.WriteLine("Please type your new Password");
string newpass = Console.ReadLine();
newUser.password = newpass;
Console.WriteLine($"Your new password is {newUser.password}");
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.userMenu();
}

}

public static void userInfo(createuser newUser)
{

string newpassword = new string('*', newUser.password.Length);
Console.WriteLine($"Your User Name is: {newUser.userName}");
Console.WriteLine($"Your Password is: {newpassword}");
Console.WriteLine("Press any Key to return to menu.");
Console.ReadKey();
}


}
}
20 replies