WELLCOME

Visual Basic is a very easy and powerful programming language, a very simple coding of the software can be created with Visual Basic. I have my Blogger (http://www.vbcodebd.blogspot.com) in Visual basic 6.0 via kinds Program will discuss the code. Thanks All ..........

Wednesday, February 13, 2013

Option Button Program code vb 6.0 (Visual Basic Tutorial - 13)


Form Design:
Create a form with      3 text boxe , 3 Label , 4 Option Buttons And 3 command button.


Label properties…………..
Label1 Caption- Number1
Label2 Caption- Number2
Label3 Caption- Sumation

Option buttons properties…………..
Option Buttons 1 Caption- +
Option Buttons 1 Caption-  -
Option Buttons 1 Caption- *
Option Buttons 1 Caption- /

Command buttons properties…………..
Command buttons 1 - Caption: Clear
Command buttons 2 - Caption: Ok
Command buttons 3 - Caption: Exit



Add the following code to the form code module for the Formr1 _Click event:


Program code:

Private Sub Command1_Click()
Text1 = ""
Text2 = ""
Text3 = ""

End Sub

Private Sub Command2_Click()
Dim a, b, sum As Double
a = Val(Text1)
b = Val(Text2)

If Option1 = True Then
sum = a + b
Text3 = sum
End If

If Option2 = True Then
sum = a - b
Text3 = sum
End If

If Option3 = True Then
sum = a * b
Text3 = sum
End If

If Option4 = True Then
sum = a / b
Text3 = sum
End If

End Sub

Private Sub Command3_Click()
End

End Sub

……………………………………….................
Download this  Project File click hear
..............................................................
by Md. Sayemon
.............................................................................

3 comments: