Results 1 to 4 of 4

Thread: sstab and textbox validation

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    California, USA
    Posts
    111

    Unhappy

    I have a sstab with 6 tabs. I have a few textboxes on one of the tabs with range checking. When I go from textbox to textbox, validation event executes. But when I am in a textbox and click a tab, validation doesn't execute. Sstab causesvalidation property is set to true. How can I make validation occur before going on to the next tab? Thanks.

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Call the textbox_validate event from the sstab_click event. you'll have to pass a value to the cancel var of the validate event. but that should get you what you want.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    California, USA
    Posts
    111
    Is there a way of telling which textbox was selected before the sstab was clicked so that I don't have to check all the textboxes for errors? My validation code is below. I can't get the sstab with the error to show up and setfocus on that textbox. Thanks.

    Private Sub SSTab_Click(PreviousTab As Integer)
    Call txtATW_Validate(False)
    End Sub

    Private Sub txtATW_Validate(Cancel As Boolean)
    Call rangecheckTW(txtATW, Cancel)
    End Sub

    Private Sub rangecheckTW(txtTW As TextBox, Cancel As boolean)
    If IsNumeric(txtTW) = False Then
    txtTW.Text = 0
    MsgBox "Need a number between 0 and 800"
    Cancel = True
    Call highlightselection(txtTW)
    ElseIf txtTW.Text < 0 Or txtTW.Text > 800 Then
    If txtTW.Text < 0 Then
    txtTW.Text = 0
    Else
    txtTW.Text = 800
    End If
    MsgBox "Incorrect number. The range is between 0 and 800"
    Cancel = True
    Call highlightselection(txtTW)
    End If
    'txtTW.Text = Format$(txtTW.Text, "000")
    End Sub

    does it look correct?? Thanks

  4. #4
    New Member
    Join Date
    Jan 2001
    Posts
    3

    SSTab and TextBox validation

    From the information on another posting, I solved the same problem by ensuring that all labels are contained on frames within the SSTab. I don't know why this works, but it seems to.

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