You are here:

Visual Basic/Comparing Integers


In Visual Basic Studio 2012, what is the coding to compare two integers (Greater than, less than, equal to)?

i do not code in vb 2012 but the code in vb 2008 can be as below:
put 2 textboxes and a button on the form and add this code:
name of project and Form CompareInts
Public Class CompareInts

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

       Dim i As Integer, j As Integer

       i = Val(TextBox1.Text)
       j = Val(TextBox2.Text)
       If TextBox1.Text = "" Or TextBox2.Text = "" Then Exit Sub

       If i > j Then
         MsgBox(i & ">" & j)

       ElseIf i < j Then
         MsgBox(i & "<" & j)
       ElseIf i = j Then
         MsgBox(i & "=" & j)
       End If

   End Sub
End Class

Visual Basic

All Answers

Answers by Expert:

Ask Experts




visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.(VB6) basic questions in vb 2008. Optional: 1)a large number of people want me to do work which takes some time and effort. can do projects in vb 2008. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a good amount. 4) you can visit my website


programming since the past 15 years. have completed a large number of projects in Industrial applications, finance,accounts, correspondence. excel macros etc

engineering, management degrees.

Past/Present Clients
project work for a Norway company,USA company and a Canadian company completed. Freelance Project work and Teaching. helping programmers with their work
teaching vb

©2017 All rights reserved.