unwanted characters in a textbox

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

    unwanted characters in a textbox

    I have a value bieng added into my array that displays correctly in
    the textbox as 0.10 however when i read from my array into an excel
    spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
    characters????
  • Lloyd Sheen

    #2
    Re: unwanted characters in a textbox

    cmdolcet69 wrote:
    I have a value bieng added into my array that displays correctly in
    the textbox as 0.10 however when i read from my array into an excel
    spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
    characters????
    Is your textbox a multiline textbox? If so the chars you see may be a
    carriage return / line feed. Perhaps showing some code might help.

    LS

    Comment

    • Lloyd Sheen

      #3
      Re: unwanted characters in a textbox

      cmdolcet69 wrote:
      I have a value bieng added into my array that displays correctly in
      the textbox as 0.10 however when i read from my array into an excel
      spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
      characters????
      Is your textbox a multiline textbox? If so the chars you see may be a
      carriage return / line feed. Perhaps showing some code might help.

      LS

      Comment

      • cmdolcet69

        #4
        Re: unwanted characters in a textbox

        On Jul 24, 2:11 pm, Lloyd Sheen <a...@b.cwrot e:
        cmdolcet69 wrote:
        I have a value bieng added into my array that displays correctly in
        the textbox as 0.10 however when i read from my array into an excel
        spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
        characters????
        >
        Is your textbox a multiline textbox? If so the chars you see may be a
        carriage return / line feed. Perhaps showing some code might help.
        >
        LS
        There really isn;t any code all i do is pull the serial information
        from a controller....w hat would be the best way to get those [] [] off?

        Comment

        • cmdolcet69

          #5
          Re: unwanted characters in a textbox

          On Jul 24, 2:11 pm, Lloyd Sheen <a...@b.cwrot e:
          cmdolcet69 wrote:
          I have a value bieng added into my array that displays correctly in
          the textbox as 0.10 however when i read from my array into an excel
          spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
          characters????
          >
          Is your textbox a multiline textbox? If so the chars you see may be a
          carriage return / line feed. Perhaps showing some code might help.
          >
          LS
          Lloyd, here the code the STRdata is tring to convert the
          end.GetString(m abtRxbuf) but the string value coming over is for
          example "0.10[][]

          what is going on?


          Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
          Integer
          Dim iReadChars, iRc As Integer
          Dim strdata as string

          ' 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 iRc = 0 Then
          ' Read Error
          Throw New ApplicationExce ption( _
          "ReadFile error " & iRc.ToString)
          Else
          'commmented out because of issues with overflow
          ' Handles timeout or returns input chars
          'If iReadChars < Bytes2Read Then
          'Throw New IOTimeoutExcept ion("Timeout error")
          'Else
          mbWaitOnRead = True
          Return (iReadChars)
          End If
          End If
          End If
          End Function

          Comment

          • =?Utf-8?B?UmFhdDE5Nzk=?=

            #6
            RE: unwanted characters in a textbox

            first it would be wise to figure out what the characters are

            in excel enter the formula "=code(right(yo urcell),1)) this will tell you the
            character code for the last [] (replace youcell with the cell your data is in)

            to know the fore last character use "=code(mid(your cell,len(yource ll)-1,1))
            (not 100% sure about the -1, might be -2... excel sometimes uses 1 as floor
            and sometimes not)

            If you get 10 and 13 you could enable wordwrap in excel (cellproperties ,
            second tab, one of the 3 checkboxes at the botom, and try again)

            "cmdolcet69 " wrote:
            I have a value bieng added into my array that displays correctly in
            the textbox as 0.10 however when i read from my array into an excel
            spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
            characters????
            >

            Comment

            • Lloyd Sheen

              #7
              Re: unwanted characters in a textbox

              cmdolcet69 wrote:
              On Jul 24, 2:11 pm, Lloyd Sheen <a...@b.cwrot e:
              >cmdolcet69 wrote:
              >>I have a value bieng added into my array that displays correctly in
              >>the textbox as 0.10 however when i read from my array into an excel
              >>spreadsheet I get the value 0.10 [][] how can I get rid of the [][]
              >>characters??? ?
              >Is your textbox a multiline textbox? If so the chars you see may be a
              >carriage return / line feed. Perhaps showing some code might help.
              >>
              >LS
              >
              Lloyd, here the code the STRdata is tring to convert the
              end.GetString(m abtRxbuf) but the string value coming over is for
              example "0.10[][]
              >
              what is going on?
              >
              >
              Public Function ReadValidatedDa ta(ByVal Bytes2Read As Integer) As
              Integer
              Dim iReadChars, iRc As Integer
              Dim strdata as string
              >
              ' 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 iRc = 0 Then
              ' Read Error
              Throw New ApplicationExce ption( _
              "ReadFile error " & iRc.ToString)
              Else
              'commmented out because of issues with overflow
              ' Handles timeout or returns input chars
              'If iReadChars < Bytes2Read Then
              'Throw New IOTimeoutExcept ion("Timeout error")
              'Else
              mbWaitOnRead = True
              Return (iReadChars)
              End If
              End If
              End If
              End Function
              You will need to find out what the two extra characters are.

              In VS immediate window use:

              ?asc(STRdateSub string(STRDataL ength-1,1))
              and
              asc(songname.Su bstring(SongNam e.Length-2,1))

              If the values returned are 13 and 10 you are getting a CR/LF
              combination. If not this will help determine what the characters are.

              LS

              Comment

              Working...