5 Replies - 375 Views - Last Post: 21 January 2019 - 09:16 AM Rate Topic: -----

#1 deannas99   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-January 19

How do I validate user input?

Posted 21 January 2019 - 06:24 AM

If output >= 0 AndAlso output <= 1000 Then
UnitsTextbox.AppendText(Environment.NewLine & InputTextbox.Text)
Else
MessageBox.Show("ERROR! Number must be between 0 and 1000!")
End If

So above is the code I have been working on. Now I'm trying to validate the user input and I need the numbers to be from 0 to 1000 and display an error message if they are not. I have no problem doing that it works fine but I have all output displayed in a textbox and even if its wrong its still putting that number in my output textbox how do i fix that?

Is This A Good Question/Topic? 0
  • +

Replies To: How do I validate user input?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15215
  • View blog
  • Posts: 60,899
  • Joined: 12-June 08

Re: How do I validate user input?

Posted 21 January 2019 - 08:27 AM

Is this in some sort of event or something? If so cancel the event, and put focus back on the textbox.
Was This Post Helpful? 0
  • +
  • -

#3 deannas99   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-January 19

Re: How do I validate user input?

Posted 21 January 2019 - 08:30 AM

Its executed when the enter button if thats what you mean
but i honestly dont know if its an event if it is how do I cancel it?
im still kind of learning this stuff and havent gotten very good yet
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15215
  • View blog
  • Posts: 60,899
  • Joined: 12-June 08

Re: How do I validate user input?

Posted 21 January 2019 - 08:42 AM

I would have to see the event's code or what ever..

Now is this actually vb6 or vb.net?
Was This Post Helpful? 0
  • +
  • -

#5 deannas99   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-January 19

Re: How do I validate user input?

Posted 21 January 2019 - 08:50 AM

er i think it might be vb.net
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15215
  • View blog
  • Posts: 60,899
  • Joined: 12-June 08

Re: How do I validate user input?

Posted 21 January 2019 - 09:16 AM

Are you using some like Visual Studios 2017, or are you using something from 15 years ago?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1