Booleans

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmdolcet69

    Booleans

    I have setup a boolean based on the following conditions

    Public STRData as string
    Public BooleanRedFlag as boolean = False

    If STRData = "" then
    _BooleanRedFlag = TRue
    end If

    What should happen is that is the STRData string is returned with
    nothing it should set my boolean flag.
    When i add a break point and a watch to my code the STRData value
    says its true.

    What am I missing it should read "".
  • jdrott1

    #2
    Re: Booleans

    On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
    I have setup a boolean based on the following conditions
    >
    Public STRData as string
    Public BooleanRedFlag as boolean = False
    >
    If STRData = "" then
    _BooleanRedFlag = TRue
    end If
    >
    What should happen is that is the STRData string is returned with
    nothing it should set my boolean flag.
    When i add a break point and a watch to my code the STRData  value
    says its true.
    >
    What am I missing it should read "".
    looks like you've set the "" = true

    Comment

    • cmdolcet69

      #3
      Re: Booleans

      On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
      On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
      >
      I have setup a boolean based on the following conditions
      >
      Public STRData as string
      Public BooleanRedFlag as boolean = False
      >
      If STRData = "" then
      _BooleanRedFlag = TRue
      end If
      >
      What should happen is that is the STRData string is returned with
      nothing it should set my boolean flag.
      When i add a break point and a watch to my code the STRData value
      says its true.
      >
      What am I missing it should read "".
      >
      looks like you've set the "" = true
      Yes how can i set it to be true if STRDAta = "" but i still need to
      keep STRdata a string

      Comment

      • jdrott1

        #4
        Re: Booleans

        On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
        On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
        >
        >
        >
        >
        >
        On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
        >
        I have setup a boolean based on the following conditions
        >
        Public STRData as string
        Public BooleanRedFlag as boolean = False
        >
        If STRData = "" then
        _BooleanRedFlag = TRue
        end If
        >
        What should happen is that is the STRData string is returned with
        nothing it should set my boolean flag.
        When i add a break point and a watch to my code the STRData  value
        says its true.
        >
        What am I missing it should read "".
        >
        looks like you've set the "" =  true
        >
        Yes how can i set it to be true if STRDAta = "" but i still need to
        keep STRdata a string- Hide quoted text -
        >
        - Show quoted text -
        whats the rest of the code and where are you putting the break point?
        you have it correct there is something preceding it not correct.

        Dim variable1 As String
        Dim variable2 As Boolean = False
        If variable1 = "" Then
        variable2 = True
        end if

        Comment

        • Gillard

          #5
          Re: Booleans


          you declare BooleanRedFlag
          and you use _BooleanRedFlag

          this is 2 differents variables

          "cmdolcet69 " <colin_dolcetti @hotmail.comwro te in message
          news:f86b3120-0fa5-4b25-a2a1-84a9966da78e@k3 0g2000hse.googl egroups.com...
          On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
          >On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
          >>
          I have setup a boolean based on the following conditions
          >>
          Public STRData as string
          Public BooleanRedFlag as boolean = False
          >>
          If STRData = "" then
          _BooleanRedFlag = TRue
          end If
          >>
          What should happen is that is the STRData string is returned with
          nothing it should set my boolean flag.
          When i add a break point and a watch to my code the STRData value
          says its true.
          >>
          What am I missing it should read "".
          >>
          >looks like you've set the "" = true
          >
          Yes how can i set it to be true if STRDAta = "" but i still need to
          keep STRdata a string

          Comment

          • cmdolcet69

            #6
            Re: Booleans

            On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
            On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
            >
            >
            >
            On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
            >
            On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
            >
            I have setup a boolean based on the following conditions
            >
            Public STRData as string
            Public BooleanRedFlag as boolean = False
            >
            If STRData = "" then
            _BooleanRedFlag = TRue
            end If
            >
            What should happen is that is the STRData string is returned with
            nothing it should set my boolean flag.
            When i add a break point and a watch to my code the STRData value
            says its true.
            >
            What am I missing it should read "".
            >
            looks like you've set the "" = true
            >
            Yes how can i set it to be true if STRDAta = "" but i still need to
            keep STRdata a string- Hide quoted text -
            >
            - Show quoted text -
            >
            whats the rest of the code and where are you putting the break point?
            you have it correct there is something preceding it not correct.
            >
            Dim variable1 As String
            Dim variable2 As Boolean = False
            If variable1 = "" Then
            variable2 = True
            end if
            Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
            Integer
            Dim iReadChars, iRc As Integer

            ' If Bytes2Read not specified uses Buffersize
            If Bytes2Read = 0 Then Bytes2Read = miBufferSize
            If mhRS = -1 Then
            Throw New ApplicationExce ption( _
            "Please initialize and open port before using this
            method")
            Else

            ' Creates an event for overlapped operations
            If meMode = Mode.Overlapped Then
            pHandleOverlapp edRead(Bytes2Re ad)
            Else
            ' Non overlapped mode
            ReDim mabtRxBuf(Bytes 2Read - 1)
            iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
            iReadChars, Nothing)


            Dim enc As New System.Text.ASC IIEncoding
            STRdata = enc.GetString(m abtRxBuf)

            If STRdata = Nothing Then
            _BadResponse = True
            Else
            End If
            end function



            I declare my STRData as a global string and I declare my _BadResponse
            as a global boolean = false

            I set my breakpoint at the If STRdata = Nothing Then


            Any help would be appreciated.

            Comment

            • jdrott1

              #7
              Re: Booleans

              On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
              On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
              >
              >
              >
              >
              >
              On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
              >
              On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
              >
              On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
              >
              I have setup a boolean based on the following conditions
              >
              Public STRData as string
              Public BooleanRedFlag as boolean = False
              >
              If STRData = "" then
              _BooleanRedFlag = TRue
              end If
              >
              What should happen is that is the STRData string is returned with
              nothing it should set my boolean flag.
              When i add a break point and a watch to my code the STRData  value
              says its true.
              >
              What am I missing it should read "".
              >
              looks like you've set the "" =  true
              >
              Yes how can i set it to be true if STRDAta = "" but i still need to
              keep STRdata a string- Hide quoted text -
              >
              - Show quoted text -
              >
              whats the rest of the code and where are you putting the break point?
              you have it correct there is something preceding it not correct.
              >
               Dim variable1 As String
                      Dim variable2 As Boolean = False
                      If variable1 = "" Then
                          variable2 = True
                      end if
              >
               Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
              Integer
                      Dim iReadChars, iRc As Integer
              >
                      ' If Bytes2Read not specified uses Buffersize
                      If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                      If mhRS = -1 Then
                          Throw New ApplicationExce ption( _
                              "Please initialize and open port before using this
              method")
                      Else
              >
                          ' Creates an event for overlapped operations
                          If meMode = Mode.Overlapped Then
                              pHandleOverlapp edRead(Bytes2Re ad)
                          Else
                              ' Non overlapped mode
                              ReDim mabtRxBuf(Bytes 2Read - 1)
                              iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
              iReadChars, Nothing)
              >
                              Dim enc As New System.Text.ASC IIEncoding
                              STRdata = enc.GetString(m abtRxBuf)
              >
                              If STRdata = Nothing Then
                                  _BadResponse = True
                              Else
                              End If
              end function
              >
              I declare my STRData as a global string and I declare my _BadResponse
              as a global boolean = false
              >
              I set my breakpoint at the   If STRdata = Nothing Then
              >
              Any help would be appreciated.- Hide quoted text -
              >
              - Show quoted text -
              if you put the break point on "if strdata = nothing"

              what does it say for you global _BadResponse? is it still set to
              false?
              are you checking the strdata in the global position for the return
              value?
              do you use the variable in any other functions that might return a
              value before you hit the break point?

              Comment

              • jdrott1

                #8
                Re: Booleans

                On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                >
                >
                >
                >
                >
                On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                >
                On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                >
                On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                >
                On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                >
                I have setup a boolean based on the following conditions
                >
                Public STRData as string
                Public BooleanRedFlag as boolean = False
                >
                If STRData = "" then
                _BooleanRedFlag = TRue
                end If
                >
                What should happen is that is the STRData string is returned with
                nothing it should set my boolean flag.
                When i add a break point and a watch to my code the STRData  value
                says its true.
                >
                What am I missing it should read "".
                >
                looks like you've set the "" =  true
                >
                Yes how can i set it to be true if STRDAta = "" but i still need to
                keep STRdata a string- Hide quoted text -
                >
                - Show quoted text -
                >
                whats the rest of the code and where are you putting the break point?
                you have it correct there is something preceding it not correct.
                >
                 Dim variable1 As String
                        Dim variable2 As Boolean = False
                        If variable1 = "" Then
                            variable2 = True
                        end if
                >
                 Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                Integer
                        Dim iReadChars, iRc As Integer
                >
                        ' If Bytes2Read not specified uses Buffersize
                        If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                        If mhRS = -1 Then
                            Throw New ApplicationExce ption( _
                                "Please initialize and open port beforeusing this
                method")
                        Else
                >
                            ' Creates an event for overlapped operations
                            If meMode = Mode.Overlapped Then
                                pHandleOverlapp edRead(Bytes2Re ad)
                            Else
                                ' Non overlapped mode
                                ReDim mabtRxBuf(Bytes 2Read - 1)
                                iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                iReadChars, Nothing)
                >
                                Dim enc As New System.Text.ASC IIEncoding
                                STRdata = enc.GetString(m abtRxBuf)
                >
                                If STRdata = Nothing Then
                                    _BadResponse = True
                                Else
                                End If
                end function
                >
                I declare my STRData as a global string and I declare my _BadResponse
                as a global boolean = false
                >
                I set my breakpoint at the   If STRdata = Nothing Then
                >
                Any help would be appreciated.- Hide quoted text -
                >
                - Show quoted text -
                >
                if you put the break point on "if strdata = nothing"
                >
                what does it say for you global _BadResponse?  is it still set to
                false?
                are you checking the strdata in the global position for the return
                value?
                do you use the variable in any other functions that might return a
                value before you hit the break point?- Hide quoted text -
                >
                - Show quoted text -
                you are setting the string equal to something here: Dim enc As New
                System.Text.ASC IIEncoding
                STRdata = enc.GetString(m abtRxBuf)

                Comment

                • cmdolcet69

                  #9
                  Re: Booleans

                  On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                  On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                  >
                  >
                  >
                  On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                  >
                  On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                  >
                  On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                  >
                  On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                  >
                  On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                  >
                  I have setup a boolean based on the following conditions
                  >
                  Public STRData as string
                  Public BooleanRedFlag as boolean = False
                  >
                  If STRData = "" then
                  _BooleanRedFlag = TRue
                  end If
                  >
                  What should happen is that is the STRData string is returned with
                  nothing it should set my boolean flag.
                  When i add a break point and a watch to my code the STRData value
                  says its true.
                  >
                  What am I missing it should read "".
                  >
                  looks like you've set the "" = true
                  >
                  Yes how can i set it to be true if STRDAta = "" but i still need to
                  keep STRdata a string- Hide quoted text -
                  >
                  - Show quoted text -
                  >
                  whats the rest of the code and where are you putting the break point?
                  you have it correct there is something preceding it not correct.
                  >
                  Dim variable1 As String
                  Dim variable2 As Boolean = False
                  If variable1 = "" Then
                  variable2 = True
                  end if
                  >
                  Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                  Integer
                  Dim iReadChars, iRc As Integer
                  >
                  ' If Bytes2Read not specified uses Buffersize
                  If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                  If mhRS = -1 Then
                  Throw New ApplicationExce ption( _
                  "Please initialize and open port before using this
                  method")
                  Else
                  >
                  ' Creates an event for overlapped operations
                  If meMode = Mode.Overlapped Then
                  pHandleOverlapp edRead(Bytes2Re ad)
                  Else
                  ' Non overlapped mode
                  ReDim mabtRxBuf(Bytes 2Read - 1)
                  iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                  iReadChars, Nothing)
                  >
                  Dim enc As New System.Text.ASC IIEncoding
                  STRdata = enc.GetString(m abtRxBuf)
                  >
                  If STRdata = Nothing Then
                  _BadResponse = True
                  Else
                  End If
                  end function
                  >
                  I declare my STRData as a global string and I declare my _BadResponse
                  as a global boolean = false
                  >
                  I set my breakpoint at the If STRdata = Nothing Then
                  >
                  Any help would be appreciated.- Hide quoted text -
                  >
                  - Show quoted text -
                  >
                  if you put the break point on "if strdata = nothing"
                  >
                  what does it say for you global _BadResponse? is it still set to
                  false?
                  are you checking the strdata in the global position for the return
                  value?
                  do you use the variable in any other functions that might return a
                  value before you hit the break point?- Hide quoted text -
                  >
                  - Show quoted text -
                  >
                  you are setting the string equal to something here: Dim enc As New
                  System.Text.ASC IIEncoding
                  STRdata = enc.GetString(m abtRxBuf)
                  Ok maybe the cause of the issue could be this line:
                  Dim enc As New System.Text.ASC IIEncoding
                  STRdata = enc.GetString(m abtRxBuf)

                  because when i look closely at the STRdata string it comes over =
                  "0.10[]" It should only read "0.10" could this [] be throwing
                  everything off???and if so how can I get this our of my STRdata
                  string.

                  Comment

                  • James Hahn

                    #10
                    Re: Booleans

                    I think possibly that the debugger is confusing you.

                    If you examine
                    STRdata = Nothing
                    or
                    STRdata=""
                    in the debugger it will indicate true or false. This refers to the
                    expression, which is either true or false depending on the current value of
                    STRdata..

                    If you examine
                    STRdata
                    then the debugger should indicate the value of the string.

                    "cmdolcet69 " <colin_dolcetti @hotmail.comwro te in message
                    news:baecd4e8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                    On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                    >On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                    >>
                    >>
                    >>
                    On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                    >>
                    On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                    >>
                    On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                    >>
                    On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                    >>
                    On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                    wrote:
                    >>
                    I have setup a boolean based on the following conditions
                    >>
                    Public STRData as string
                    Public BooleanRedFlag as boolean = False
                    >>
                    If STRData = "" then
                    _BooleanRedFlag = TRue
                    end If
                    >>
                    What should happen is that is the STRData string is returned
                    with
                    nothing it should set my boolean flag.
                    When i add a break point and a watch to my code the STRData
                    value
                    says its true.
                    >>
                    What am I missing it should read "".
                    >>
                    looks like you've set the "" = true
                    >>
                    Yes how can i set it to be true if STRDAta = "" but i still need
                    to
                    keep STRdata a string- Hide quoted text -
                    >>
                    - Show quoted text -
                    >>
                    whats the rest of the code and where are you putting the break
                    point?
                    you have it correct there is something preceding it not correct.
                    >>
                    Dim variable1 As String
                    Dim variable2 As Boolean = False
                    If variable1 = "" Then
                    variable2 = True
                    end if
                    >>
                    Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                    Integer
                    Dim iReadChars, iRc As Integer
                    >>
                    ' If Bytes2Read not specified uses Buffersize
                    If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                    If mhRS = -1 Then
                    Throw New ApplicationExce ption( _
                    "Please initialize and open port before using this
                    method")
                    Else
                    >>
                    ' Creates an event for overlapped operations
                    If meMode = Mode.Overlapped Then
                    pHandleOverlapp edRead(Bytes2Re ad)
                    Else
                    ' Non overlapped mode
                    ReDim mabtRxBuf(Bytes 2Read - 1)
                    iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                    iReadChars, Nothing)
                    >>
                    Dim enc As New System.Text.ASC IIEncoding
                    STRdata = enc.GetString(m abtRxBuf)
                    >>
                    If STRdata = Nothing Then
                    _BadResponse = True
                    Else
                    End If
                    end function
                    >>
                    I declare my STRData as a global string and I declare my _BadResponse
                    as a global boolean = false
                    >>
                    I set my breakpoint at the If STRdata = Nothing Then
                    >>
                    Any help would be appreciated.- Hide quoted text -
                    >>
                    - Show quoted text -
                    >>
                    if you put the break point on "if strdata = nothing"
                    >>
                    what does it say for you global _BadResponse? is it still set to
                    false?
                    are you checking the strdata in the global position for the return
                    value?
                    do you use the variable in any other functions that might return a
                    value before you hit the break point?- Hide quoted text -
                    >>
                    - Show quoted text -
                    >>
                    >you are setting the string equal to something here: Dim enc As New
                    >System.Text.AS CIIEncoding
                    > STRdata = enc.GetString(m abtRxBuf)
                    >
                    Ok maybe the cause of the issue could be this line:
                    Dim enc As New System.Text.ASC IIEncoding
                    STRdata = enc.GetString(m abtRxBuf)
                    >
                    because when i look closely at the STRdata string it comes over =
                    "0.10[]" It should only read "0.10" could this [] be throwing
                    everything off???and if so how can I get this our of my STRdata
                    string.

                    Comment

                    • Jack Jackson

                      #11
                      Re: Booleans

                      Also note that STRdata = Nothing is True only if STRdata is Nothing.

                      STRdata = "" is True if STRdata is the empty string ("") or Nothing.

                      On Wed, 27 Aug 2008 10:54:18 +1000, "James Hahn" <jhahn@yahoo.co m>
                      wrote:
                      >I think possibly that the debugger is confusing you.
                      >
                      >If you examine
                      STRdata = Nothing
                      >or
                      STRdata=""
                      >in the debugger it will indicate true or false. This refers to the
                      >expression, which is either true or false depending on the current value of
                      >STRdata..
                      >
                      >If you examine
                      >STRdata
                      >then the debugger should indicate the value of the string.
                      >
                      >"cmdolcet69 " <colin_dolcetti @hotmail.comwro te in message
                      >news:baecd4e 8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                      >On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                      >>On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                      >>>
                      >>>
                      >>>
                      >On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                      >>>
                      >On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                      >>>
                      > On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                      >>>
                      > On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                      >>>
                      > On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                      > wrote:
                      >>>
                      > I have setup a boolean based on the following conditions
                      >>>
                      > Public STRData as string
                      > Public BooleanRedFlag as boolean = False
                      >>>
                      > If STRData = "" then
                      > _BooleanRedFlag = TRue
                      > end If
                      >>>
                      > What should happen is that is the STRData string is returned
                      > with
                      > nothing it should set my boolean flag.
                      > When i add a break point and a watch to my code the STRData
                      > value
                      > says its true.
                      >>>
                      > What am I missing it should read "".
                      >>>
                      > looks like you've set the "" = true
                      >>>
                      > Yes how can i set it to be true if STRDAta = "" but i still need
                      > to
                      > keep STRdata a string- Hide quoted text -
                      >>>
                      > - Show quoted text -
                      >>>
                      > whats the rest of the code and where are you putting the break
                      > point?
                      > you have it correct there is something preceding it not correct.
                      >>>
                      > Dim variable1 As String
                      > Dim variable2 As Boolean = False
                      > If variable1 = "" Then
                      > variable2 = True
                      > end if
                      >>>
                      > Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                      >Integer
                      > Dim iReadChars, iRc As Integer
                      >>>
                      > ' If Bytes2Read not specified uses Buffersize
                      > If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                      > If mhRS = -1 Then
                      > Throw New ApplicationExce ption( _
                      > "Please initialize and open port before using this
                      >method")
                      > Else
                      >>>
                      > ' Creates an event for overlapped operations
                      > If meMode = Mode.Overlapped Then
                      > pHandleOverlapp edRead(Bytes2Re ad)
                      > Else
                      > ' Non overlapped mode
                      > ReDim mabtRxBuf(Bytes 2Read - 1)
                      > iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                      >iReadChars, Nothing)
                      >>>
                      > Dim enc As New System.Text.ASC IIEncoding
                      > STRdata = enc.GetString(m abtRxBuf)
                      >>>
                      > If STRdata = Nothing Then
                      > _BadResponse = True
                      > Else
                      > End If
                      >end function
                      >>>
                      >I declare my STRData as a global string and I declare my _BadResponse
                      >as a global boolean = false
                      >>>
                      >I set my breakpoint at the If STRdata = Nothing Then
                      >>>
                      >Any help would be appreciated.- Hide quoted text -
                      >>>
                      >- Show quoted text -
                      >>>
                      >if you put the break point on "if strdata = nothing"
                      >>>
                      >what does it say for you global _BadResponse? is it still set to
                      >false?
                      >are you checking the strdata in the global position for the return
                      >value?
                      >do you use the variable in any other functions that might return a
                      >value before you hit the break point?- Hide quoted text -
                      >>>
                      >- Show quoted text -
                      >>>
                      >>you are setting the string equal to something here: Dim enc As New
                      >>System.Text.A SCIIEncoding
                      >> STRdata = enc.GetString(m abtRxBuf)
                      >>
                      >Ok maybe the cause of the issue could be this line:
                      >Dim enc As New System.Text.ASC IIEncoding
                      >STRdata = enc.GetString(m abtRxBuf)
                      >>
                      >because when i look closely at the STRdata string it comes over =
                      >"0.10[]" It should only read "0.10" could this [] be throwing
                      >everything off???and if so how can I get this our of my STRdata
                      >string.

                      Comment

                      • cmdolcet69

                        #12
                        Re: Booleans

                        On Aug 27, 2:02 am, Jack Jackson <jjack...@cinno vations.netwrot e:
                        Also note that STRdata = Nothing is True only if STRdata is Nothing.
                        >
                        STRdata = "" is True if STRdata is the empty string ("") or Nothing.
                        >
                        On Wed, 27 Aug 2008 10:54:18 +1000, "James Hahn" <jh...@yahoo.co m>
                        wrote:
                        >
                        I think possibly that the debugger is confusing you.
                        >
                        If you examine
                        STRdata = Nothing
                        or
                        STRdata=""
                        in the debugger it will indicate true or false. This refers to the
                        expression, which is either true or false depending on the current value of
                        STRdata..
                        >
                        If you examine
                        STRdata
                        then the debugger should indicate the value of the string.
                        >
                        "cmdolcet69 " <colin_dolce... @hotmail.comwro te in message
                        news:baecd4e8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                        On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                        >On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                        >
                        On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                        >
                        On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                        >
                        On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                        >
                        On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                        >
                        On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                        wrote:
                        >
                        I have setup a boolean based on the following conditions
                        >
                        Public STRData as string
                        Public BooleanRedFlag as boolean = False
                        >
                        If STRData = "" then
                        _BooleanRedFlag = TRue
                        end If
                        >
                        What should happen is that is the STRData string is returned
                        with
                        nothing it should set my boolean flag.
                        When i add a break point and a watch to my code the STRData
                        value
                        says its true.
                        >
                        What am I missing it should read "".
                        >
                        looks like you've set the "" = true
                        >
                        Yes how can i set it to be true if STRDAta = "" but i still need
                        to
                        keep STRdata a string- Hide quoted text -
                        >
                        - Show quoted text -
                        >
                        whats the rest of the code and where are you putting the break
                        point?
                        you have it correct there is something preceding it not correct.
                        >
                        Dim variable1 As String
                        Dim variable2 As Boolean = False
                        If variable1 = "" Then
                        variable2 = True
                        end if
                        >
                        Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                        Integer
                        Dim iReadChars, iRc As Integer
                        >
                        ' If Bytes2Read not specified uses Buffersize
                        If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                        If mhRS = -1 Then
                        Throw New ApplicationExce ption( _
                        "Please initialize and open port before using this
                        method")
                        Else
                        >
                        ' Creates an event for overlapped operations
                        If meMode = Mode.Overlapped Then
                        pHandleOverlapp edRead(Bytes2Re ad)
                        Else
                        ' Non overlapped mode
                        ReDim mabtRxBuf(Bytes 2Read - 1)
                        iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                        iReadChars, Nothing)
                        >
                        Dim enc As New System.Text.ASC IIEncoding
                        STRdata = enc.GetString(m abtRxBuf)
                        >
                        If STRdata = Nothing Then
                        _BadResponse = True
                        Else
                        End If
                        end function
                        >
                        I declare my STRData as a global string and I declare my _BadResponse
                        as a global boolean = false
                        >
                        I set my breakpoint at the If STRdata = Nothing Then
                        >
                        Any help would be appreciated.- Hide quoted text -
                        >
                        - Show quoted text -
                        >
                        if you put the break point on "if strdata = nothing"
                        >
                        what does it say for you global _BadResponse? is it still set to
                        false?
                        are you checking the strdata in the global position for the return
                        value?
                        do you use the variable in any other functions that might return a
                        value before you hit the break point?- Hide quoted text -
                        >
                        - Show quoted text -
                        >
                        >you are setting the string equal to something here: Dim enc As New
                        >System.Text.AS CIIEncoding
                        > STRdata = enc.GetString(m abtRxBuf)
                        >
                        Ok maybe the cause of the issue could be this line:
                        Dim enc As New System.Text.ASC IIEncoding
                        STRdata = enc.GetString(m abtRxBuf)
                        >
                        because when i look closely at the STRdata string it comes over =
                        "0.10[]" It should only read "0.10" could this [] be throwing
                        everything off???and if so how can I get this our of my STRdata
                        string.
                        I have used the following to try and get my condition to hit inside
                        the loop

                        If STRdata is string.empty then
                        BoolRedFlag = true
                        end if


                        If STRdata.lenght= 0 then
                        BoolRedFlag = true
                        end if



                        if STRdata = "" then
                        BoolRedFlag = true
                        end if


                        Nothing will ever hit the BoolRedFlag even if the STRdata="" when i
                        highlight over the STRdata = it give me a value of True however if i
                        highlight over just the STRdata it will give me a value of "" which i
                        would think the above statements would catch and go into the loop.

                        Comment

                        • cmdolcet69

                          #13
                          Re: Booleans

                          On Aug 26, 8:54 pm, "James Hahn" <jh...@yahoo.co mwrote:
                          I think possibly that the debugger is confusing you.
                          >
                          If you examine
                          STRdata = Nothing
                          or
                          STRdata=""
                          in the debugger it will indicate true or false. This refers to the
                          expression, which is either true or false depending on the current value of
                          STRdata..
                          >
                          If you examine
                          STRdata
                          then the debugger should indicate the value of the string.
                          >
                          "cmdolcet69 " <colin_dolce... @hotmail.comwro te in message
                          >
                          news:baecd4e8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                          >
                          On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                          On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                          >
                          On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                          >
                          On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                          >
                          On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                          >
                          On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                          >
                          On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                          wrote:
                          >
                          I have setup a boolean based on the following conditions
                          >
                          Public STRData as string
                          Public BooleanRedFlag as boolean = False
                          >
                          If STRData = "" then
                          _BooleanRedFlag = TRue
                          end If
                          >
                          What should happen is that is the STRData string is returned
                          with
                          nothing it should set my boolean flag.
                          When i add a break point and a watch to my code the STRData
                          value
                          says its true.
                          >
                          What am I missing it should read "".
                          >
                          looks like you've set the "" = true
                          >
                          Yes how can i set it to be true if STRDAta = "" but i still need
                          to
                          keep STRdata a string- Hide quoted text -
                          >
                          - Show quoted text -
                          >
                          whats the rest of the code and where are you putting the break
                          point?
                          you have it correct there is something preceding it not correct.
                          >
                          Dim variable1 As String
                          Dim variable2 As Boolean = False
                          If variable1 = "" Then
                          variable2 = True
                          end if
                          >
                          Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                          Integer
                          Dim iReadChars, iRc As Integer
                          >
                          ' If Bytes2Read not specified uses Buffersize
                          If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                          If mhRS = -1 Then
                          Throw New ApplicationExce ption( _
                          "Please initialize and open port before using this
                          method")
                          Else
                          >
                          ' Creates an event for overlapped operations
                          If meMode = Mode.Overlapped Then
                          pHandleOverlapp edRead(Bytes2Re ad)
                          Else
                          ' Non overlapped mode
                          ReDim mabtRxBuf(Bytes 2Read - 1)
                          iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                          iReadChars, Nothing)
                          >
                          Dim enc As New System.Text.ASC IIEncoding
                          STRdata = enc.GetString(m abtRxBuf)
                          >
                          If STRdata = Nothing Then
                          _BadResponse = True
                          Else
                          End If
                          end function
                          >
                          I declare my STRData as a global string and I declare my _BadResponse
                          as a global boolean = false
                          >
                          I set my breakpoint at the If STRdata = Nothing Then
                          >
                          Any help would be appreciated.- Hide quoted text -
                          >
                          - Show quoted text -
                          >
                          if you put the break point on "if strdata = nothing"
                          >
                          what does it say for you global _BadResponse? is it still set to
                          false?
                          are you checking the strdata in the global position for the return
                          value?
                          do you use the variable in any other functions that might return a
                          value before you hit the break point?- Hide quoted text -
                          >
                          - Show quoted text -
                          >
                          you are setting the string equal to something here: Dim enc As New
                          System.Text.ASC IIEncoding
                          STRdata = enc.GetString(m abtRxBuf)
                          >
                          Ok maybe the cause of the issue could be this line:
                          Dim enc As New System.Text.ASC IIEncoding
                          STRdata = enc.GetString(m abtRxBuf)
                          >
                          because when i look closely at the STRdata string it comes over =
                          "0.10[]" It should only read "0.10" could this [] be throwing
                          everything off???and if so how can I get this our of my STRdata
                          string.
                          You are correct in that saying however how can i get it into my
                          condition? It seems to skip over it each time?

                          Comment

                          • Jack Jackson

                            #14
                            Re: Booleans

                            On Wed, 27 Aug 2008 07:02:45 -0700 (PDT), cmdolcet69
                            <colin_dolcetti @hotmail.comwro te:
                            >On Aug 27, 2:02 am, Jack Jackson <jjack...@cinno vations.netwrot e:
                            >Also note that STRdata = Nothing is True only if STRdata is Nothing.
                            >>
                            >STRdata = "" is True if STRdata is the empty string ("") or Nothing.
                            >>
                            >On Wed, 27 Aug 2008 10:54:18 +1000, "James Hahn" <jh...@yahoo.co m>
                            >wrote:
                            >>
                            >I think possibly that the debugger is confusing you.
                            >>
                            >If you examine
                            STRdata = Nothing
                            >or
                            STRdata=""
                            >in the debugger it will indicate true or false. This refers to the
                            >expression, which is either true or false depending on the current value of
                            >STRdata..
                            >>
                            >If you examine
                            >STRdata
                            >then the debugger should indicate the value of the string.
                            >>
                            >"cmdolcet69 " <colin_dolce... @hotmail.comwro te in message
                            >news:baecd4e 8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                            >On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                            >>On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                            >>
                            >On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                            >>
                            >On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                            >>
                            > On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                            >>
                            > On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                            >>
                            > On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                            > wrote:
                            >>
                            > I have setup a boolean based on the following conditions
                            >>
                            > Public STRData as string
                            > Public BooleanRedFlag as boolean = False
                            >>
                            > If STRData = "" then
                            > _BooleanRedFlag = TRue
                            > end If
                            >>
                            > What should happen is that is the STRData string is returned
                            > with
                            > nothing it should set my boolean flag.
                            > When i add a break point and a watch to my code the STRData
                            > value
                            > says its true.
                            >>
                            > What am I missing it should read "".
                            >>
                            > looks like you've set the "" = true
                            >>
                            > Yes how can i set it to be true if STRDAta = "" but i still need
                            > to
                            > keep STRdata a string- Hide quoted text -
                            >>
                            > - Show quoted text -
                            >>
                            > whats the rest of the code and where are you putting the break
                            > point?
                            > you have it correct there is something preceding it not correct.
                            >>
                            > Dim variable1 As String
                            > Dim variable2 As Boolean = False
                            > If variable1 = "" Then
                            > variable2 = True
                            > end if
                            >>
                            > Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                            >Integer
                            > Dim iReadChars, iRc As Integer
                            >>
                            > ' If Bytes2Read not specified uses Buffersize
                            > If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                            > If mhRS = -1 Then
                            > Throw New ApplicationExce ption( _
                            > "Please initialize and open port before using this
                            >method")
                            > Else
                            >>
                            > ' Creates an event for overlapped operations
                            > If meMode = Mode.Overlapped Then
                            > pHandleOverlapp edRead(Bytes2Re ad)
                            > Else
                            > ' Non overlapped mode
                            > ReDim mabtRxBuf(Bytes 2Read - 1)
                            > iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                            >iReadChars, Nothing)
                            >>
                            > Dim enc As New System.Text.ASC IIEncoding
                            > STRdata = enc.GetString(m abtRxBuf)
                            >>
                            > If STRdata = Nothing Then
                            > _BadResponse = True
                            > Else
                            > End If
                            >end function
                            >>
                            >I declare my STRData as a global string and I declare my _BadResponse
                            >as a global boolean = false
                            >>
                            >I set my breakpoint at the If STRdata = Nothing Then
                            >>
                            >Any help would be appreciated.- Hide quoted text -
                            >>
                            >- Show quoted text -
                            >>
                            >if you put the break point on "if strdata = nothing"
                            >>
                            >what does it say for you global _BadResponse? is it still set to
                            >false?
                            >are you checking the strdata in the global position for the return
                            >value?
                            >do you use the variable in any other functions that might return a
                            >value before you hit the break point?- Hide quoted text -
                            >>
                            >- Show quoted text -
                            >>
                            >>you are setting the string equal to something here: Dim enc As New
                            >>System.Text.A SCIIEncoding
                            >> STRdata = enc.GetString(m abtRxBuf)
                            >>
                            >Ok maybe the cause of the issue could be this line:
                            >Dim enc As New System.Text.ASC IIEncoding
                            >STRdata = enc.GetString(m abtRxBuf)
                            >>
                            >because when i look closely at the STRdata string it comes over =
                            >"0.10[]" It should only read "0.10" could this [] be throwing
                            >everything off???and if so how can I get this our of my STRdata
                            >string.
                            >
                            >I have used the following to try and get my condition to hit inside
                            >the loop
                            >
                            >If STRdata is string.empty then
                            BoolRedFlag = true
                            >end if
                            >
                            >
                            >If STRdata.lenght= 0 then
                            >BoolRedFlag = true
                            >end if
                            >
                            >
                            >
                            >if STRdata = "" then
                            >BoolRedFlag = true
                            >end if
                            >
                            >
                            >Nothing will ever hit the BoolRedFlag even if the STRdata="" when i
                            >highlight over the STRdata = it give me a value of True however if i
                            >highlight over just the STRdata it will give me a value of "" which i
                            >would think the above statements would catch and go into the loop.
                            The only test you should need is If STRdata = "". Put a breakpoint on
                            the If STRdata = "" line. When the code gets there step it.

                            Comment

                            • James Hahn

                              #15
                              Re: Booleans

                              Please refer to your other post. You may be seeing a string which consists
                              of non-ASCII characters. This string will not be equal to "" even if it
                              looks empty. When the debugger breaks use an expression such as
                              STRdata.Length or Asc(STRdata) to examine the string.

                              "cmdolcet69 " <colin_dolcetti @hotmail.comwro te in message
                              news:1a007876-4780-40c8-bb36-1ba4ee8b2673@59 g2000hsb.google groups.com...
                              On Aug 26, 8:54 pm, "James Hahn" <jh...@yahoo.co mwrote:
                              >I think possibly that the debugger is confusing you.
                              >>
                              >If you examine
                              > STRdata = Nothing
                              >or
                              > STRdata=""
                              >in the debugger it will indicate true or false. This refers to the
                              >expression, which is either true or false depending on the current value
                              >of
                              >STRdata..
                              >>
                              >If you examine
                              >STRdata
                              >then the debugger should indicate the value of the string.
                              >>
                              >"cmdolcet69 " <colin_dolce... @hotmail.comwro te in message
                              >>
                              >news:baecd4e 8-f781-4a44-9768-ef78ba6cd2ee@a1 g2000hsb.google groups.com...
                              >>
                              On Aug 26, 4:21 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                              >On Aug 26, 3:19 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                              >>
                              On Aug 26, 3:03 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
                              >>
                              On Aug 26, 3:55 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                              >>
                              On Aug 26, 2:42 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                              wrote:
                              >>
                              On Aug 26, 3:35 pm, jdrott1 <jonathandr...@ gmail.comwrote:
                              >>
                              On Aug 26, 2:33 pm, cmdolcet69 <colin_dolce... @hotmail.com>
                              wrote:
                              >>
                              I have setup a boolean based on the following conditions
                              >>
                              Public STRData as string
                              Public BooleanRedFlag as boolean = False
                              >>
                              If STRData = "" then
                              _BooleanRedFlag = TRue
                              end If
                              >>
                              What should happen is that is the STRData string is
                              returned
                              with
                              nothing it should set my boolean flag.
                              When i add a break point and a watch to my code the
                              STRData
                              value
                              says its true.
                              >>
                              What am I missing it should read "".
                              >>
                              looks like you've set the "" = true
                              >>
                              Yes how can i set it to be true if STRDAta = "" but i still
                              need
                              to
                              keep STRdata a string- Hide quoted text -
                              >>
                              - Show quoted text -
                              >>
                              whats the rest of the code and where are you putting the break
                              point?
                              you have it correct there is something preceding it not correct.
                              >>
                              Dim variable1 As String
                              Dim variable2 As Boolean = False
                              If variable1 = "" Then
                              variable2 = True
                              end if
                              >>
                              Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
                              Integer
                              Dim iReadChars, iRc As Integer
                              >>
                              ' If Bytes2Read not specified uses Buffersize
                              If Bytes2Read = 0 Then Bytes2Read = miBufferSize
                              If mhRS = -1 Then
                              Throw New ApplicationExce ption( _
                              "Please initialize and open port before using this
                              method")
                              Else
                              >>
                              ' Creates an event for overlapped operations
                              If meMode = Mode.Overlapped Then
                              pHandleOverlapp edRead(Bytes2Re ad)
                              Else
                              ' Non overlapped mode
                              ReDim mabtRxBuf(Bytes 2Read - 1)
                              iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
                              iReadChars, Nothing)
                              >>
                              Dim enc As New System.Text.ASC IIEncoding
                              STRdata = enc.GetString(m abtRxBuf)
                              >>
                              If STRdata = Nothing Then
                              _BadResponse = True
                              Else
                              End If
                              end function
                              >>
                              I declare my STRData as a global string and I declare my
                              _BadResponse
                              as a global boolean = false
                              >>
                              I set my breakpoint at the If STRdata = Nothing Then
                              >>
                              Any help would be appreciated.- Hide quoted text -
                              >>
                              - Show quoted text -
                              >>
                              if you put the break point on "if strdata = nothing"
                              >>
                              what does it say for you global _BadResponse? is it still set to
                              false?
                              are you checking the strdata in the global position for the return
                              value?
                              do you use the variable in any other functions that might return a
                              value before you hit the break point?- Hide quoted text -
                              >>
                              - Show quoted text -
                              >>
                              >you are setting the string equal to something here: Dim enc As New
                              >System.Text.AS CIIEncoding
                              > STRdata = enc.GetString(m abtRxBuf)
                              >>
                              Ok maybe the cause of the issue could be this line:
                              Dim enc As New System.Text.ASC IIEncoding
                              STRdata = enc.GetString(m abtRxBuf)
                              >>
                              because when i look closely at the STRdata string it comes over =
                              "0.10[]" It should only read "0.10" could this [] be throwing
                              everything off???and if so how can I get this our of my STRdata
                              string.
                              >
                              You are correct in that saying however how can i get it into my
                              condition? It seems to skip over it each time?

                              Comment

                              Working...