none
InputBox function: How can I restrict the length RRS feed

  • Question

  • Hi all of you,

    Primary Platform is Framework 2.0

    Is it possible? I mean, I wanna to accept only six characters in the inputbox dialog

     Dim valorEAN As String = InputBox("Introduce el código EAN", "GIT")
    
            If valorEAN <> String.Empty Then
                Me.chkListEansCode.Items.Add(valorEAN.Trim)
    
            End If

    TIA,


    Enric

    Thursday, May 17, 2012 8:14 PM

Answers

  • InputBox doesn't have the option to do this, but you could easily remove any extra characters afterwards:

    Dim valorEAN As String = InputBox("Introduce el código EAN", "GIT")
    
            If valorEAN <> String.Empty Then
                Me.chkListEansCode.Items.Add(valorEAN.Left(6)) ' String.Left(6) will restrict to 6 letters
    
            End If


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Enric Vives Thursday, May 17, 2012 8:20 PM
    Thursday, May 17, 2012 8:19 PM
    Moderator

All replies

  • InputBox doesn't have the option to do this, but you could easily remove any extra characters afterwards:

    Dim valorEAN As String = InputBox("Introduce el código EAN", "GIT")
    
            If valorEAN <> String.Empty Then
                Me.chkListEansCode.Items.Add(valorEAN.Left(6)) ' String.Left(6) will restrict to 6 letters
    
            End If


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by Enric Vives Thursday, May 17, 2012 8:20 PM
    Thursday, May 17, 2012 8:19 PM
    Moderator
  • Thanks indeeed Reed!

    Enric

    Thursday, May 17, 2012 8:31 PM