How do I error check a text box between 2 values?

Hi everyone, so I was wondering if someone could help me out, so to sum up the app, its for a drinks machine and sends values over bluetooth (number of shots and drink size). What I am trying to do is error check so that a person cannot enter a shot values below 1 or above 9. Below is what I had so far but I dont think it is right and I dont think it would stop the person entering an integer out of bounds. Any help would be very appreciated.
Thanks in advance.
Dean.

You also add in then statement
textbox set to empty, textbox request focus, disable button sent and then show a notifier informing that values should be in that range 1-9
else enable sent button

What a new text box set to empty or set textbox 3 to empty and if it is textbox 3 to empty how do you set it to empty?

Thank you!!

1 Like

@dora_paz sorry but where is the button1. Enabled part?

This looks like a good place to use a List Picker for shots count, with Elements 1,2,3,...9.
No validation would be needed.

There are many valid ways to check for data entry errors. Here is another one

enterOnlyNumbers1to9

Right, is this using a list picker because the way I have my app set up I have a text box but no button with it. I just have another button that sends all the values. Is there a way to error check the text box without needing an additional button?

Thanks for everyones comments?

Certainly, put the code that checks if is in list? for the TextBox1.Text in the other Button.

No this does not use a ListPicker. :slight_smile: Make a small Project as a test and try it???

Right thank you so much everyone.

1 Like

Hi everyone, I did make a post about this a day or so ago, but I was busy didnt get chance to try syggestions till now, but I still didnt understand them. Pretty much what I need to be able to do is error check to see is a value entered into a text box is from 1-9, without the use of a button. As when my app sends the data it sends it once a notifier is confirmed. How my code sends the data is shown below.

This was the image from the other post thats someone posted, that looked well but still relied on a button press.
image

And below is a photo of my design just so people can visualise what I have better.
Thanks in advance.
Dean.

You possibly could introduce the error control doing something like this

where the SendText blocks will contain the example's TextBox1 instead of you code. Sorry, I do not understand what you want to do but this information might allow you to use the code suggested without a Button. It should only send the data in TextBox1 if it is valid.

Good luck with your Project Dean.

Forgot to post this awhile ago, for anyone wondering this was the solution, for anyone in the future.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.