This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label Operators. Show all posts
Showing posts with label Operators. Show all posts

Sunday, December 9, 2012

Arithmetic,String And Relational Operators In Visual Basic


Dim i, j, r as integer
private sub cmdadd_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i + j
msgbox “addition is:” & r
end sub

Private sub cmdsub_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i– j
msgbox “subtraction is:” & r
end sub

Private sub cmdmul_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i * j
msgbox “multiplication is:”  & r
end sub

Private sub cmddiv_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i / j
msgbox “division is:” & r
end sub

Private sub cmdintdiv_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i \ j
msgbox “integer division is:” & r
end sub

Private sub cmdexp_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i ^ j
msgbox “exponentional is:” & r
end sub

Private sub cmdmod_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
r = i mod j
msgbox “mod is:” & r
end sub



Private sub cmdconcatenate_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
msgbox txtnum1.text & txtnum2.text
end sub

Private sub cmdless_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i< j) then
msgbox "num 1 is less"
else
msgbox "num 2 is less"
end if
end sub

Private sub cmdgtr_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i> j) then
msgbox "num 1 is greater"
else
msgbox "num 2 is greater"
end if
end sub

Private sub cmdlessequal_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i<= j) then
msgbox " num 1 is less than or equal to num 2"
else
msgbox " num 1 is greater"
end if
end sub

Private sub cmdgtrequal_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i>= j) then
msgbox " num 1 is greater than or equal to num 2"
else
msgbox " num 1 is less"
end if
end sub

Private sub cmdequal_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i = j) then
msgbox "num is equal"
else
msgbox "num is not equal
end if
end sub

Private sub cmdnotequal_click()
i = val(txtnum1.text)
j = val(txtnum2.text)
if (i<> j) then
msgbox "num is not equal"
else
msgbox "num is equal"
end if
end sub


Output 




Note:- Please set some property of your control like caption or id corresponding to your control