Click here to Skip to main content
14,840,611 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionShould I begin with razor pages or mvc? Pin
Dawud Ahmad29-Nov-19 6:29
MemberDawud Ahmad29-Nov-19 6:29 
AnswerRe: Should I begin with razor pages or mvc? Pin
Richard MacCutchan29-Nov-19 7:27
mveRichard MacCutchan29-Nov-19 7:27 
AnswerRe: Should I begin with razor pages or mvc? Pin
Richard Deeming29-Nov-19 8:01
mveRichard Deeming29-Nov-19 8:01 
QuestionNewbie here. Why is my array list not working? Pin
Marc Hede28-Nov-19 0:31
MemberMarc Hede28-Nov-19 0:31 
AnswerRe: Newbie here. Why is my array list not working? Pin
phil.o28-Nov-19 0:41
mvephil.o28-Nov-19 0:41 
AnswerRe: Newbie here. Why is my array list not working? Pin
Richard Deeming28-Nov-19 1:24
mveRichard Deeming28-Nov-19 1:24 
GeneralRe: Newbie here. Why is my array list not working? Pin
Marc Hede28-Nov-19 6:14
MemberMarc Hede28-Nov-19 6:14 
GeneralRe: Newbie here. Why is my array list not working? Pin
Richard Deeming28-Nov-19 6:39
mveRichard Deeming28-Nov-19 6:39 
Member 14671427 wrote:
and also changed "ListBoxResults" to simply "ListBox"

Which is not what I said, and is the cause of the "object reference required" errors.

Remove the property; leave the Page_Load method as I showed you:
namespace Pig
{
    public partial class Index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Driver d1 = new Driver("Hans", "Christensen", 32, "hans@pig.dk", 123456);
            Driver d2 = new Driver("Peter", "Jensen", 40, "peter@mail.dk", 123456);
            Admin a1 = new Admin("Lene", "Maarud", 55, "lene@pig.dk");
            ListBoxResults.Items.Add(d1.ToString());
            ListBoxResults.Items.Add(d2.ToString());
            ListBoxResults.Items.Add(a1.ToString());
        }
    }
}


Member 14671427 wrote:
Error: "Property or indexer cannot be assigned to -- it is read only"

You haven't added a setter to the Email property, so you can't set it.

If you don't want to be able to change it from outside of the class, then make the setter private:
public string Email { get; private set; }



Member 14671427 wrote:
There is no argument given that corresponds to the required formal parameter of 'firstName' of 'Person.Person (string, string, int, string)'

Your Person constructor requires four arguments. Every constructor of a class derived from Person must pass those four arguments into the base constructor.
public Driver(string v1, string v2, string v3, string v4, string v5)
    : base("??? FIRST NAME ???", "??? LAST NAME ???", 0, "??? EMAIL ???")




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Newbie here. Why is my array list not working? Pin
Marc Hede28-Nov-19 9:09
MemberMarc Hede28-Nov-19 9:09 
GeneralRe: Newbie here. Why is my array list not working? Pin
Richard Deeming29-Nov-19 0:34
mveRichard Deeming29-Nov-19 0:34 
GeneralRe: Newbie here. Why is my array list not working? Pin
Marc Hede29-Nov-19 3:00
MemberMarc Hede29-Nov-19 3:00 
QuestionDuring redirection localhost is not attached and page failed to load Pin
Member 1115418827-Nov-19 23:59
MemberMember 1115418827-Nov-19 23:59 
AnswerRe: During redirection localhost is not attached and page failed to load Pin
Richard Deeming28-Nov-19 1:18
mveRichard Deeming28-Nov-19 1:18 
QuestionASP.net In Visual Studio 2019 Pin
Ebrahimaw20-Nov-19 13:09
MemberEbrahimaw20-Nov-19 13:09 
AnswerRe: ASP.net In Visual Studio 2019 Pin
Eddy Vluggen20-Nov-19 14:03
professionalEddy Vluggen20-Nov-19 14:03 
QuestionSQL Parameter Collection - Not able to assign to SQLCommand Pin
Member 1115418819-Nov-19 6:11
MemberMember 1115418819-Nov-19 6:11 
AnswerRe: SQL Parameter Collection - Not able to assign to SQLCommand Pin
Richard MacCutchan19-Nov-19 6:19
mveRichard MacCutchan19-Nov-19 6:19 
General[Solved] Re: SQL Parameter Collection - Not able to assign to SQLCommand Pin
Member 1115418819-Nov-19 19:10
MemberMember 1115418819-Nov-19 19:10 
QuestionWhat's so bad about webforms? Pin
DerekT-P18-Nov-19 4:29
professionalDerekT-P18-Nov-19 4:29 
AnswerRe: What's so bad about webforms? Pin
jkirkerx18-Nov-19 13:47
professionaljkirkerx18-Nov-19 13:47 
PraiseRe: What's so bad about webforms? Pin
Eddy Vluggen18-Nov-19 14:19
professionalEddy Vluggen18-Nov-19 14:19 
GeneralRe: What's so bad about webforms? Pin
jkirkerx18-Nov-19 16:07
professionaljkirkerx18-Nov-19 16:07 
GeneralRe: What's so bad about webforms? Pin
Eddy Vluggen19-Nov-19 2:47
professionalEddy Vluggen19-Nov-19 2:47 
GeneralRe: What's so bad about webforms? Pin
F-ES Sitecore18-Nov-19 23:18
mveF-ES Sitecore18-Nov-19 23:18 
GeneralRe: What's so bad about webforms? Pin
Richard Deeming19-Nov-19 1:21
mveRichard Deeming19-Nov-19 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.