Results 1 to 2 of 2

Thread: Asp.NET

  1. #1

    Question Asp.NET

    Hai,


    In one interview i faced one question but i coudn't answer that.


    I have to create two text boxes for inserting two numbers and a button and onr more text box for getting result.

    I have to use class and in this class i have to use properties instead of methods to get this text box values. how to do this

    Pls help me...... Its urgent............

    Thanks
    Praseetha


  2. #2
    Junior Member
    Join Date
    Jul 2006
    Answers
    22

    Re: Asp.NET

    U can use in this way for example
    public class class1
    private name, place, details as string
    public property username() as string
    get
    return name
    end get
    set(byval value as string)
    name = value
    end set
    end property
    public property userplace() as string
    get
    return place
    end get
    set(byval value as string)
    place = value
    end set
    end property
    public readonly property displayuserdetails() as string
    get
    details = username + " place is " + userplace
    return details
    end get
    end property
    end class

    then u can use this class like

    dim k as new class1

    k.username = textbox1.text

    k.userplace = textbox2.text

    textbox3.text = k.displayuserdetails

    so here we are utilizing properties not methods


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact