Results 1 to 9 of 9

Thread: After click ok button all controls displaying data clear in dataentry form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2010
    Posts
    229

    After click ok button all controls displaying data clear in dataentry form

    Hi I am working VB.NET08.

    After click the ok button all controls of displaying data should be clear in dataentry form.
    If i enter some data in the Combobox or Textbox for saving the data into the database, If i click the OK button all controls of displaying data should be clear, B`se i want to enter next record, so how can i do this??
    Is there any Refresh Property is there?
    Thanks

  2. #2
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: After click ok button all controls displaying data clear in dataentry form

    You can set the value of all the controls to whatever their empty value is. Do you have a "Clear" button on the data-entry form as well? (This is a pretty common thing to have).

    You can do it the very easy but tedious way of updating each control on its own line of code. You could alternatively do it the hard way of iterating over the collection of all controls and working out what property you should be setting and what value you should be setting it to. This means you don't have to keep updating your Clear method when you change the form.

    I'd heartily recommend the first method, frankly.

  3. #3
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: After click ok button all controls displaying data clear in dataentry form

    Quote Originally Posted by malatesh kumar View Post
    Hi I am working VB.NET08.

    After click the ok button all controls of displaying data should be clear in dataentry form.
    If i enter some data in the Combobox or Textbox for saving the data into the database, If i click the OK button all controls of displaying data should be clear, B`se i want to enter next record, so how can i do this??
    Is there any Refresh Property is there?
    Thanks
    hi malatesh, do you want that when you click the submit but or ok button to store the record into the database and all the controls on the form get clear? am i getting your right? do you really want this?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2010
    Posts
    229

    Re: After click ok button all controls displaying data clear in dataentry form

    Hi GM
    Sorry for the giving delay response.
    Yes exactly i want this..
    May i know how can i do??
    Thanks for giving support.

  5. #5
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: After click ok button all controls displaying data clear in dataentry form

    ok, you need to have a clear button on form right. on on the click event of that button type the following code.

    textbox1.clear
    textbox2.clear
    ......

    after clicking on this button your form will be clear

    now go to the click even of the submit or store buttton right.
    you might have written the insert query and all other coding right,
    where your code get finishes, after that paste the code which you have placed at the click event of clear button.

    now when you will enter the entry on form and after clicking the submit button, first the insert query will be operated and then all the controls will be cleared.

  6. #6
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: After click ok button all controls displaying data clear in dataentry form

    by this way you will be able to clear your form both way, by pressing clear button and by pressing submit button too.

  7. #7
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,121

    Re: After click ok button all controls displaying data clear in dataentry form

    instead of writing the same code multiple times, put the code in a Sub and then you can call it from anywhere in the form.
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records
    VB.Net | C#

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | SQL Basics

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    May 2010
    Posts
    229

    Re: After click ok button all controls displaying data clear in dataentry form

    HI GM
    Thanks i will try it.

  9. #9
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    Re: After click ok button all controls displaying data clear in dataentry form

    yes coach barker mentioned the more sophisticated thing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width