Help, I help with my form!!!!!!!!!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Help, I help with my form!!!!!!!!!!

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Help, I help with my form!!!!!!!!!!

    [Originally posted by Kristine Wilton]

    I need to disable my print button, until calculation is complete, and disable calulation button untilall fields are entered˙ Any help could be greatly appreciated

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help, I help with my form!!!!!!!!!!

    [Originally posted by Marc Cramer]

    Hello...
    you could try
    if field.text<>"" then calculate.enabled=true

    and for the calculation...

    sub CalculateMe()
    do some stuff
    print.enabled=true
    end sub


  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help, I help with my form!!!!!!!!!!

    [Originally posted by Sanjaya]

    HI!

    ˙ I had provide this help with thinking you're using textboxes for your fields.


    Create a subroutine for validation, like this

    Private Sub Validation()

    For Each ctrlControl In Form1.Controls
    ˙ ˙ 'Check text boxes
    ˙ ˙ If TypeOf ctrlControl Is TextBox Then
    ˙ ˙ ˙ ˙ ˙ 'Check for empty textboxes
    ˙ ˙ ˙ ˙ ˙ If ctrlControl.Text = vbNullString Then
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = False
    ˙ ˙ ˙ ˙ ˙ Else
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = True
    ˙ ˙ ˙ ˙ ˙ End If
    ˙ ˙ End If
    Next


    End Sub

    After that you have to call that sub in each textbox's change event. Just type

    Validation

    only.

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help, I help with my form!!!!!!!!!!

    [Originally posted by Sanjaya]

    HI!

    ˙ I had provide this help with thinking you're using textboxes for your fields.


    Create a subroutine for validation, like this

    Private Sub Validation()

    For Each ctrlControl In Form1.Controls
    ˙ ˙ 'Check text boxes
    ˙ ˙ If TypeOf ctrlControl Is TextBox Then
    ˙ ˙ ˙ ˙ ˙ 'Check for empty textboxes
    ˙ ˙ ˙ ˙ ˙ If ctrlControl.Text = vbNullString Then
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = False
    ˙ ˙ ˙ ˙ ˙ Else
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = True
    ˙ ˙ ˙ ˙ ˙ End If
    ˙ ˙ End If
    Next


    End Sub

    After that you have to call that sub in each textbox's change event. Just type

    Validation

    only.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help, I help with my form!!!!!!!!!!

    [Originally posted by Ed Ardzinski]

    Some good ideas...When I need fields to be filled out completely before performing an operation I usually do a "Brute Force" type of validation...I define an integer variable (I usually call it 'intErr'), and create If blocks to deal with checking the required fields.

    Usually they look sort of like this:

    If (Text1 = "")Then
    intErr = MsgBox("Text1 needs data!", vbExclamation + vbOKOnly, "Doh!!!")
    Text1.SetFocus
    Exit Sub
    End If

    Put a series of these before the code that performs your calculation, and if any of the criteria are not me, the sub will exit before the calculation, and focus will be placed to the field that has the problem.

    Often I can group several of these routines together into a sub in the class module; at the very most I have a little editing to do after a copy/paste.˙ This approach has generally worked very well for me...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center