We are atsked to create a net salary calculator or something that computes the net salary. I used three radio button in which if it is selected, it has corresponding solution for each selection. The three radio button are probationary, regular and permanent.......here is the code

Private Sub Command1_Click()
Dim a As Long


If Option1.value = true Then
textbox2.text = val(((a*1)*12)+40000-((a*1)*12))
ElseIf Option2.value = true Then
textbox2.text = val(((a*1.15)*12)+40000-((a*1.15)*12))
ElseIf Option3.value = true Then
textbox2.text = val(((a*1.25)*12)+40000-((a*1.25)*12))
textbox1 = a

End If
End Sub

I will attach the picture of how it should look like.......

now the question is I don't know what is wrong and what to input to make the answer be shown in textbox2........can anyone help me....are the conditions in vb 6 and vb 2008 the same? cause I am used to vb 2008 but it seemed that the commands I am using are not working in vb 6......oh and I decalerd the commands in the compute button.....thank you very much for your immediate reply.....it will help me alot.....

Attachments Cloud.jpg 165.21 KB

What is the initial value of a ?

and the screen shot suggests you have created control arrray of Option button.

so tehnically there is no control named Option1, Option2 and Option3

what you have is Option1(1),Option1(2),Option1(3)

Edited 4 Years Ago by debasisdas

as you can see in the attached picture, I declared textbox1 as "a" wherein it is the "rate" so whatever value written in the textbox would be the value of "a"........it says that my declaration of "a" is an error.. How can I declare textbox1 as "a"? and is it write I declared all these commands in the button???

Edited 4 Years Ago by akasekaihime

the compiler error always says "Method or data member not found" then points out the .text in textbox2.text declaration and highlights the "Private Sub Command1_Click()"....what is the meaning of this??

then it should have been

a = textbox1
not the other way around.

and it should have been placed just below the declaration of a the variable.

and again as i have said earlier, you have tried to copy and paste controls and that resulted in creating a control array of controls (for option buttons) . I am not sure if you have done the same for textboxes also.

thanks a lot......it is now working.............here are the changes that I have made in the code......

Private Sub Command1_Click()
Dim a As Long

a = Text1

If Option1.Value = True Then
Text2.Text = Val(((a * 1) * 12) + 40000 - ((a * 1) * 0.12))

ElseIf Option2.Value = True Then
Text2.Text = Val(((a * 1.15) * 12) + 40000 - ((a * 1.15) * 0.12))
ElseIf Option3.Value = True Then
Text2.Text = Val(((a * 1.25) * 12) + 40000 - ((a * 1.25) * 0.12))

End If
End Sub
This question has already been answered. Start a new discussion instead.