Where i made the mistake?
2014-10-29, 04:45 AM,
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])
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
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"
Share This Thread :

2014-10-29, 02:22 PM,
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
          MsgBox("Do whatever you wanna do, here!")
     End If
     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!


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

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

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