Results 1 to 7 of 7

Thread: reset program

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    23

    reset program

    Hi i have created a program where the data is put into a database, after that i wish to reset and clear the program, is there a simple line of code to use? please help

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Candon City, Ilocos Sur, Phils.
    Posts
    11,044

    Re: reset program

    Clear the program of what?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: reset program

    Clear the fields? just use..for example

    txtName.Text = ""
    txtDOB.Text = ""
    txtAddress.Text = ""
    Chris

  4. #4
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    266

    Re: reset program

    U need to make a function to clear there fields
    and then call it wherever u want...but i think there is no any single line code for doing so ... may b u could b able to do it by using
    For i = 1 To form1.textbox.count - 1
    form1.textbox(i).Text = ""
    next i

    ...but for this u need to make control array of the textboxes

  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: reset program

    Quote Originally Posted by noshaba
    U need to make a function to clear there fields
    and then call it wherever u want...but i think there is no any single line code for doing so ... may b u could b able to do it by using
    For i = 1 To form1.textbox.count - 1
    form1.textbox(i).Text = ""
    next i

    ...but for this u need to make control array of the textboxes
    No need for an array when you want to loop through, use the controls collection (you can also use it to make a general clear Sub):

    VB Code:
    1. Private Sub ClearControls()
    2.     Dim ctl As Control
    3.     For Each ctl In Me.Controls
    4.         Select Case True
    5.             Case TypeOf ctl Is TextBox
    6.                 ctl.Text = vbNullString
    7.             Case TypeOf ctl Is ComboBox, TypeOf ctl Is ListBox
    8.                 ctl.Clear
    9.             '
    10.             '
    11.             '
    12.         End Select
    13.     Next ctl
    14. End Sub

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reset program

    There is a way that I do it and have discussed it before but some don't think outside the box. What you can do is design your program so that all your data is is a data class object then just set the object to nothing and re-instanciate it for all data to be cleared.

    Of course you would have to do this at the beginning to code to this standard. But it will work.

  7. #7
    Lively Member Moneybucks's Avatar
    Join Date
    Apr 2006
    Location
    Kingston Upon Thames -UK
    Posts
    123

    Re: reset program

    The only way I can think to do this is to unload all your past forms, open up the home form again and type

    (name of home form).refresh
    If, somehow, I help you, please rate the post using the scales icon in the left bar <---- .

    Please Use Naming Conventions in your projects! ------\/
    http://www.visibleprogress.com/vb_na...onventions.htm

    Me to Brother
    -Hey, look at this avater I made in about 5 seconds
    -What, morrisons?
    -AGHHHHHH

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