simple project

This is a discussion on simple project within the C# Programming forums, part of the General Programming Boards category; Hi..!! I'm doing a simple week end project. In this i need to know a event. Which is A form ...

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    28

    simple project

    Hi..!!
    I'm doing a simple week end project. In this i need to know a event. Which is A form has text box and label which is student roll no. And name. After enter the 6 digit student roll no in the the textbox corresponding roll no 's name have to display frm a label. With out pressing any button. Which event is suitable for this case.

    Thank you

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,532
    There's more options, but you may want to start with a simple TextChanged event: C# TextChanged Event

    Although not mentioned there, it is a good practice to always check your textbox value for an empty string or clearly invalid data before doing any expensive computation like accessing a database to fetch your student's name.

    Code:
    void rollNumber_TextChanged(object sender, EventArgs e)
    {
        if (rollNumber.Text.Trim() == String.Empty || rollNumber.Text.Length < 5)
            return;
    
    
        rollName.Text = GetStudent(rollNumber.Text);
    }
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Optionally you can use data binding and data validation via IDataErrorInfo.

    Data binding:
    http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

    IDataErrorInfo:
    http://msdn.microsoft.com/en-us/libr...errorinfo.aspx

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    28
    Thank you..!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with simple c project-as as possible
    By vlador3 in forum C Programming
    Replies: 2
    Last Post: 10-19-2012, 09:35 AM
  2. Need help with file input on simple C++ Project
    By Trooper88 in forum C++ Programming
    Replies: 2
    Last Post: 12-08-2010, 01:11 PM
  3. Help with a simple Terminal Project
    By Sretsam in forum C Programming
    Replies: 12
    Last Post: 09-19-2010, 06:36 PM
  4. Simple project becomes very annoying.
    By ... in forum C++ Programming
    Replies: 6
    Last Post: 02-27-2002, 11:42 PM
  5. Replies: 1
    Last Post: 11-06-2001, 02:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21