On Aug 26, 2:33 pm, cmdolcet69 <
[email protected]>
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 ReadValidatedData(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 ApplicationException( _
"Please initialize and open port before using this
method")
Else
' Creates an event for overlapped operations
If meMode = Mode.Overlapped Then
pHandleOverlappedRead(Bytes2Read)
Else
' Non overlapped mode
ReDim mabtRxBuf(Bytes2Read - 1)
iRc = ReadFile(mhRS, mabtRxBuf, Bytes2Read,
iReadChars, Nothing)
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)
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.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)
Ok maybe the cause of the issue could be this line:
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)
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.