Thread: simple project

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

    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
    Ireland
    Posts
    8,446
    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);
    }
    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
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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
    33
    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, 08: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, 05: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