Results 1 to 2 of 2

Thread: text length validation

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    13

    text length validation

    Hi,

    I have a problem with validation.

    Main idea about txbBILL_NR field validation - the minimum number of characters is 4 to select records.
    In case the user enters less than 4 characters in the field by pressing the Select button,
    the app must display the warning "At least 4 characters must be entered to select entries!".
    Until at least 4 characters have been entered, record selection does not have to take place and the result field must be blank.

    So I wrote the code, thinking about validation for textbox and this does not working at all.
    I think I have a problem with this row "Me.bsBillGrid.DataSource = WSApplicant.Formated.ServiceApplicant.GetBillGrid(New WSApplicant.WS.ArgsBillGrid() With {.BILL_NR = Me.txbBILL_NR.TextLike}).ToSortableBindingList" with datasource. Can not imagine how would it be right.

    Please help me with this validation. is it ok?


    Code:
    If Me.txbBILL_NR.TextLength >= 4 Then
                Me.dgvBill.Visible = True
                Try
                    Search()
    
                    If Me.bsBillGrid.Current IsNot Nothing Then
                        Me.dgvBill.Focus()
                    End If
                Catch ex As Exception
                    Utility.ExceptionManager.HandleException(ex)
                End Try
            End If
    Last edited by EliLT; Jul 27th, 2021 at 05:58 AM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: text length validation

    Depends. Where is that code located? If it's in the right place, then it should be reasonably correct...as long as search does what you want, etc. It will only run if the length is four or greater, so that part is right.
    My usual boring signature: Nothing

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