Validate A Var

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Validate A Var

Post by Shadow3641 » Mon Apr 17, 2017 5:31 pm

Is there a way to ensure the user has inputted a number in a dialog box? So far i have came up with this but no matter what i put in it says its good.

Code: Select all

  object MSMemo5: tMSMemo
    Left = 16
    Top = 344
    Width = 241
    Height = 21
    Hint = 'Put in how many weeks it will take to be delivered.'
    Text = 'Delivery Date In Weeks'
    TabOrder = 5
  end

Code: Select all

GetDialogProperty>Dialog2,MSMemo5,Text,deliveryDate

Code: Select all

  If>%deliveryDate%>0
  Else
    MessageModal>Please ensure Delivery Date is correct.
    Let>break=1
  Endif
Thanks for the help

Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Re: Validate A Var

Post by Shadow3641 » Mon Apr 17, 2017 6:03 pm

Never mind I found a way to do it with the Format
Had to add in

Code: Select all

Format>%d,deliveryDate,result
with this any letter or special char in the string will put the value to a 0

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts