Sunday, March 10, 2013

Reset Form Contents In Visual Basic 6

There is some instances where the previously inputted values before we close the form Visual Basic 6 is still intact. Some developers suggest to manually clear all contents of the object but if you have hundreds of objects on a Form, then this will be a problem. Using the code below, you can easily reset a Form without manually clear all contents.


Sub ResetForm(F As Form)
    With Forms.Add(F.Name)
        .Move F.Left, F.Top, F.Width, F.Height
        .Show vbModal
    End With
    Unload F
End Sub