I have attached my question.

I am having some problems with the attached question. Well here is my code:

Dim Name As String

Name = TextBox1.Text

If Name = TextBox1.Text And radLT20.Checked = True Then
txtDisplay.Text = "Name is aged below 20"

ElseIf Name = TextBox1.Text And rad20To40.Checked = True Then
txtDisplay.Text = "Name is aged between 20 and 40"

ElseIf Name = TextBox1.Text And radGT40.Checked = True Then
txtDisplay.Text = "Name is aged above 40"

End If

What is wrong with my code is that when i click on the OK button i want the name that i entered in txtName to display. How can i do it???

Recommended Answers

All 2 Replies

I assume this is your code under btnOK_Click

If radLT20.Checked = True Then
  txtDisplay.Text = "" & txtName.Text & "" & "is aged below 20"
     Elseif rad20To40.Checked = True Then
        txtDisplay.Text = "" & txtName.Text & "" & "is aged between 20 and 40"
     Elseif radGT40.Checked = True Then
          txtDisplay.Text = "" & txtName.Text & "" & "is aged above 40"
End If
commented: This really worked +1

Hey thanks lots. It worked...

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.