Checkboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenin42001
    New Member
    • Jan 2007
    • 29

    #1

    Checkboxes

    Please could someone help. Here is the code we've placed in the command button for a form entitled Intelligent Personality Checker. There are three check-boxes Cinema, Mobile Phones & Beer & Food, also a text box. A command button entitled Process is supposed to put aforementioned text into the text box when the command button (btnProcess) is pressed but it doesn't work.
    Can anyone give any clues as to why this doesnt function? I've inserted the code
    below into the command-click box to no effect......... .


    Code:
    Private Sub btnProcess_Click()
       txtResult.Text = "................."
       If Check1.Checked Then
          txtResult.Text += "Cinema"
       End If
       If Check2.Checked Then
          txtResult.Text += "Mobiles"
       End If
       If Check3.Checked Then
          txtResult.Text += "Beer and Food"
       End If
       txtResult.Text += "........You really must get a life"
    End Sub
    Last edited by willakawill; Feb 2 '07, 11:07 AM. Reason: please use code tags
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by lenin42001
    Please could someone help. Here is the code we've placed in the command button for a form entitled Intelligent Personality Checker. There are three check-boxes Cinema, Mobile Phones & Beer & Food, also a text box. A command button entitled Process is supposed to put aforementioned text into the text box when the command button (btnProcess) is pressed but it doesn't work.
    Can anyone give any clues as to why this doesnt function? I've inserted the code
    below into the command-click box to no effect......... .


    Private Sub btnProcess_Clic k()
    txtResult.Text = ".............. ..."
    If Check1.Checked Then
    txtResult.Text += "Cinema"
    End If
    If Check2.Checked Then
    txtResult.Text += "Mobiles"
    End If
    If Check3.Checked Then
    txtResult.Text += "Beer and Food"
    End If
    txtResult.Text += "........Yo u really must get a life"




    End Sub

    it doesn't work???, Is this method did not responce any reply...?

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      Code:
      Private Sub btnProcess_Click()
         txtResult.Text = "................."
         If Check1.Checked Then
            txtResult.Text += "Cinema"
         End If
         If Check2.Checked Then
            txtResult.Text += "Mobiles"
         End If
         If Check3.Checked Then
            txtResult.Text += "Beer and Food"
         End If
         txtResult.Text += "........You really must get a life"
      End Sub
      Hi. You are using a c operator '+='. This does not exist in vb. Try this instead:
      Code:
      Private Sub btnProcess_Click()
         txtResult.Text = "................."
         If Check1.Checked Then
            txtResult.Text =  txtResult.Text & "Cinema"
         End If
         If Check2.Checked Then
            txtResult.Text =  txtResult.Text & "Mobiles"
         End If
         If Check3.Checked Then
            txtResult.Text =  txtResult.Text & "Beer and Food"
         End If
         txtResult.Text =  txtResult.Text & "........You really must get a life"
      End Sub

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by willakawill
        Code:
        Private Sub btnProcess_Click()
           txtResult.Text = "................."
           If Check1.Checked Then
              txtResult.Text += "Cinema"
           End If
           If Check2.Checked Then
              txtResult.Text += "Mobiles"
           End If
           If Check3.Checked Then
              txtResult.Text += "Beer and Food"
           End If
           txtResult.Text += "........You really must get a life"
        End Sub
        Hi. You are using a c operator '+='. This does not exist in vb. Try this instead:
        Code:
        Private Sub btnProcess_Click()
           txtResult.Text = "................."
           If Check1.Checked Then
              txtResult.Text =  txtResult.Text & "Cinema"
           End If
           If Check2.Checked Then
              txtResult.Text =  txtResult.Text & "Mobiles"
           End If
           If Check3.Checked Then
              txtResult.Text =  txtResult.Text & "Beer and Food"
           End If
           txtResult.Text =  txtResult.Text & "........You really must get a life"
        End Sub
        Hoooo....

        But it will work in VB.Net...(i Thought its VB.Net Program)

        Comment

        • lenin42001
          New Member
          • Jan 2007
          • 29

          #5
          Help I think its in Visual Basic6. Does this make any difference..... ......?

          Comment

          • hariharanmca
            Top Contributor
            • Dec 2006
            • 1977

            #6
            Originally posted by lenin42001
            Help I think its in Visual Basic6. Does this make any difference..... ......?

            Yes sure that VB.Net will support OOPs Concept but VB won't support so it will no work

            Comment

            • lenin42001
              New Member
              • Jan 2007
              • 29

              #7
              what should i do............. .....?

              Comment

              • willakawill
                Top Contributor
                • Oct 2006
                • 1646

                #8
                Originally posted by lenin42001
                what should i do............. .....?
                Did you try the code I posted for you?
                The button click event syntax that you posted is vb6, not .net

                Comment

                • Pragash
                  New Member
                  • Feb 2007
                  • 3

                  #9
                  Try this code
                  I don't know much more knowledge about vb but try this code

                  Code:
                  Private Sub btnProcess_Click()
                  txtResult.Text = "................."
                  If Check1.Checked Then
                     txtResult.Text = txtResult.Text & "Cinema"
                  End If
                  If Check2.Checked Then
                     txtResult.Text = txtResult.Text & "Mobiles"
                  End If
                  If Check3.Checked Then
                     txtResult.Text = txtResult.Text & "Beer and Food"
                  End If
                  txtResult.Text = txtResult.Text & "........You really must get a life"
                  End Sub
                  Last edited by willakawill; Feb 3 '07, 09:46 PM. Reason: Please use code tags

                  Comment

                  • willakawill
                    Top Contributor
                    • Oct 2006
                    • 1646

                    #10
                    Hi Pragash. You may notice that your reply is identical to the reply that I posted already.

                    Comment

                    Working...