Where i made the mistake?
2014-10-29, 04:45 AM,
#1
You know i am just a started but i want to make my fake H @ cks more legit so i was wondering where i made the mistake



Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click



If String.IsNullOrEmpty(TextBox1.Text) OrElse String.IsNullOrEmpty(TextBox2.Text) Then
MessageBox.Show("Please enter amount!", "", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Else
Dim n As Decimal
If Not Decimal.TryParse(TextBox1.Text, n) Then
MessageBox.Show("Please enter only numbers as amount!", "", MessageBoxButtons.OK, MessageBoxIcon.[Error])
End If
Dim n1 As Integer
If Not Integer.TryParse(TextBox1.Text, n1) Then
MessageBox.Show("Please enter only numbers as amount!", "", MessageBoxButtons.OK, MessageBoxIcon.[Error])
End If
TextBox3.AppendText(vbNewLine + ">_Started -" + Date.Now)
MessageBox.Show("Please wait while the hack insert your items!", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
TextBox1.Enabled = False
TextBox2.Enabled = False
Button1.Enabled = False
Timer1.Start()
End If

I want that if a user press the button and text1 area and text 2 isn't a number or it's empty to display a msg. :D
Latest Thanks - View all

DeborahC(2014-10-31 05:14 PM) 

"Knowing is not enough; we must apply. Willing is not enough we must do"
Reply
2014-10-29, 02:22 PM,
#2
Code:
If Not string.isnullorempty(textbox1.Text) orelse not string.isnullorempty(textbox2.Text) Then
     If Not isnumeric(textbox1.Text) orelse not isnumeric(textbox2.Text) Then
          MsgBox("Only numbers are allowed.")
          Exit Sub
     Else
          MsgBox("Do whatever you wanna do, here!")
     End If
Else
     MsgBox("Please fill required information!")
     Exit Sub
End If

Try the above code, it should work!

As a matter of fact, you need to stop executing the irrelevant code when the validation fails. In this context, when the user enters anything other than NUMBERS or leaves the fields' blank, then you should display the message and then use the "EXIT SUB", so that, the the code that needs to be run ONLY on successful validation does not fire or execute.

I guess that makes sense, I typed the code directly here so look out for some typos or something.

Hope that helps!

imtaurus
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Do you think there is money to be made with giveaways? ThisGuyOverHere 4 260 2017-09-30, 12:27 AM
Last Post: PRINC3
  How are these sites made? CheDz 16 1,119 2016-12-25, 12:48 AM
Last Post: CheDz
  (Must Read) Beware Guys For This Custom Made LPs And Scripts :( Thelegend 31 3,921 2016-05-03, 11:21 AM
Last Post: jugnujinga
  if you made more than 100 $ please Help Me :) ahmed22818 3 649 2016-01-21, 07:27 PM
Last Post: Jayzzz
  How to find out in what version of vb a program is made? hopsa 1 211 2015-09-06, 11:11 PM
Last Post: RushingWind




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top