Private Sub chktop_Click(Index As Integer)
'read toppings
PizzaTop = chktop(Index).Caption
End Sub

Private Sub cmdBuild_Click()
'message box
Dim message As String
Dim message2 As String
Dim I As Integer
Dim b As Double
Dim e As Double
Dim PizzaSize As String
Dim PizzaCrust As String
Dim PizzaWhere As String

If PizzaSize = small Then
b = 17
message = "Small" + "$17.00" + vbCr
End If
If PizzaSize = medium Then
b = 22
message = "Medium" + "$22.00" + vbCr
End If
If PizzaSize = large Then
b = 27
message = "Large" + "$27.00" + vbCr
End If
If PizzaWhere = eatin Then
b = b + 5
message = message + "EatIn" + "$5.00" + vbCr
Else
If PizzaWhere = takeout Then
message = message + "TakeOut" + "$0.00" + vbCr
End If
End If

message = message + PizzaCrust + vbCr

For I = 0 To 6
If chktop(I).Value = vbChecked Then message = message + chktop(I).Caption + "$1.25" + vbCr
If chktop(I).Value = vbChecked Then b = b + 1.25
Next I
e = (b * 0.125) + b
message2 = message & "Your Total is " & e
MsgBox message2, vbOKOnly, "Your Pizza"

End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub Form_Load()
'initialize pizza parameters
PizzaSize = "Small"
PizzaCrust = "Thin Crust"
PizzaWhere = "Eat In"
End Sub

Private Sub optCrust_Click(Index As Integer)
'read crust
PizzaCrust = optCrust(Index).Caption
End Sub

Private Sub optSize_Click(Index As Integer)
'read pizza size
PizzaSize = optSize(Index).Caption
End Sub

Private Sub optWhere_Click(Index As Integer)
'read Pizza eating location
PizzaWhere = optWhere(Index).Caption
End Sub

I got a problem getting my code to function

That's a darned shame. If you want help then tell us what isn't working the way you'd like. What is your code supposed to do? Any error messages? If so then on what line?

Did wrote this function to button.................

I meant if this code had written to button how can the value is pass to click event

What value? I don't speak Sinhala or Tamil and I am am not following your English so perhaps you can get someone who can better explain the problem.

I meant this:

Private Sub chktop_Click(Index As Integer

according to my knowledge I 'm not sure is it possible to pass an integer value to click event...

You are correct. The parameters for events are fixed based on the event type. The parameters are

sender As System.Object, e As System.EventArgs

However, if you want a custom value to be associated with a button you can put that value into the button's Tag property either at design or run time and get at it in the event handler as

Dim btn As Button = sender
Dim index As Integer = btn.Tag
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.