Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IF statement not working Visual Studio

Posted on 2011-09-18
1
Medium Priority
?
258 Views
Last Modified: 2012-05-12
Hi Expert

I am trying to use IF        then               End if
the following code is not working
       If grid3.Rows(intcount).Cells.Item("a3").Value = "'" & TextBox3.Text & "'" THEN
        MSGBOX("OK")
       END IF
I have looked at the value return
        grid3.Rows(intcount).Cells.Item("a3").Value
returns          ABSS
AND
           "'" & TextBox3.Text & "'"
RETURNS           ''ABSS'

Values are different


PLEASE HELP
THANKS
0
Comment
Question by:b001
1 Comment
 
LVL 3

Accepted Solution

by:
a_hassaan earned 2000 total points
ID: 36555998
no need to concatenate "'" with the text property of a text box, as this already returns a string

your code should look like this:

If grid3.Rows(intcount).Cells.Item("a3").Value = TextBox3.Text THEN
        MSGBOX("OK")
END IF
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question