Search found 68 matches

by RNBW
Mon Apr 16, 2018 3:07 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

You've just beaten me to it. I've realised that the second line should go too. I've edited the code so, hopefully, that should be it. Again, thank you for picking up the problem. The reason for the superfluous lines is that I did the code for checking for double "." first and then copied, ...
by RNBW
Mon Apr 16, 2018 2:42 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

Hi Richard. It wa slate when I was writing the code. There is of course a superfluous line which I left in, which resulted in a double check on more than one "-".

I have edited the code and removed the unnecessary line, leaving a blank line in its place.

Thank you for spotting it.
by RNBW
Sun Apr 15, 2018 10:30 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

It's quite late, but here is a snippet of code to produce filtered numeric entry into a textbox. It prevents double entry of "-" and "." and ensures "-" can only be entered as the first character. It does not address the issue of the final character being "." ...
by RNBW
Sat Apr 14, 2018 4:03 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

Richard
Thanks for reminding me. I'd forgotten that LBB has a 'proper' using() function. I was going to look for a work-around.
Ray
by RNBW
Sat Apr 14, 2018 1:27 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

tsh73 Ultimately, I would be looking to solve such issues by providing a final output with using(). This would enable the user to have as many characters after the decimal point as required. Leading zeros could be removed by using trim$. Although, in the subject matter that I would be using it, it i...
by RNBW
Sat Apr 14, 2018 9:27 am
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

tsh73 The compactness of the code is due to LBB, for which we should thank Richard Russell. Also, Richard provided the basis of the construction of the textbox grid. The function is made up of a pretty standard way of checking character input for numbers. I found the few lines that sort out preventi...
by RNBW
Fri Apr 13, 2018 5:09 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

This is a bit more advanced than the previous examples. The program sets up a grid into which you can enter numbers ( - . 0 to 9 ). It carries out a check as you enter each individual character. If it's a valid number it accepts it. If it's not valid, you will see the character very briefly before ...
by RNBW
Fri Apr 13, 2018 10:53 am
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

Richard There is the following notice on the JB Conforums site. The backup is finished. The forum is now set to read-only to prevent the need to create another backup. Whether that means that it will remain as a read-only facility, I don't know. After the reaction on the LB forum, maybe I'd better n...
by RNBW
Fri Apr 13, 2018 7:51 am
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

tsh73 Thanks for your response. As you say, the code is a bit clumsy and was just some that I have picked up along the way. Personally, what I am more interested in is the numeric input code in the grid example ( RNBW » Thu Apr 12, 2018 6:18 pm ), in which a check is made for a valid input as each c...
by RNBW
Thu Apr 12, 2018 7:11 pm
Forum: BASIC code examples
Topic: Formatting Numeric Input
Replies: 42
Views: 139297

Re: Formatting Numeric Input

Drat it Richard! Of course you are absolutely correct in all respects. I have corrected the code below and can confirm that it IS compatible with LB4. ' CODE BASED ON A ROUTINE BY BOB BROMLEY IN ONE OF THE LB NEWSLETTERS, ' WHICH I HAVE MODIFIED, BECAUSE I ONLY WANT TO ENSURE NUMERIC ENTRY. ' BOB BR...