none
May i ask how can i solve this error message (System.Windows.Forms.TextBox, Text:) i have try many way to solve but still not success to solve the problem. RRS feed

  • Question

  • I face the issue is after i scan my barcoede i will get this error message on my textbox1 can someone pls tell me how can i solve.

    is i missing something.

    Public Class Form1
        Private dataIn As String

     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            SerialPort.PortName = "COM1"
            SerialPort.BaudRate = CInt("9600")
            SerialPort.Parity = Parity.None
            SerialPort.StopBits = StopBits.One
            SerialPort.Handshake = Handshake.None
            SerialPort.Open()
            SerialPort.ReadTimeout = 200

            If SerialPort.IsOpen Then
                TextBox1.Text = ""
            End If
        End Sub

     Private Sub SerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived
            dataIn = SerialPort.ReadExisting
            TextBox1.Text += SerialPort.ReadExisting().ToString()
            SetText(TextBox1.ToString())

        End Sub
        Delegate Sub SetTextCallback(ByVal text As String)

        Private Sub SetText(ByVal text As String)
            If Me.TextBox1.InvokeRequired Then
                Dim d As SetTextCallback = New SetTextCallback(AddressOf SetText)
                Me.Invoke(d, New Object() {text})
            Else
                Me.TextBox1.Text = text.ToString


            End If
        End Sub


     

    • Edited by christing Monday, November 18, 2019 3:29 AM
    Monday, November 18, 2019 1:22 AM

Answers

  • Maybe try this too:

    Private Sub SerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived

       dataIn = SerialPort.ReadExisting

       SetText( dataIn)

    End Sub

     

    • Marked as answer by christing Monday, November 18, 2019 7:47 AM
    Monday, November 18, 2019 6:20 AM

All replies

  • Hi christing,

    >> SetText(TextBox1.ToString())

    The parameter of method SetText should be TextBox1.Text, and the TextBox1.ToString() shows the class name which cause the issue you described.

    So you shoulde modify SetText(TextBox1.ToString()) to SetText(TextBox1.Text).

    Best Regards,

    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 18, 2019 5:20 AM
  • @Daniel_Zhang-MSFT

    Thank you replay message for me. 

    After i change  SetText(TextBox1.ToString()) to SetText(TextBox1.Text). after i scan barcode i no success get the barcode information to my textbox. is i doing wrong or missing something. can you teaching me thanks. 

     
    Monday, November 18, 2019 5:39 AM
  • Maybe try this too:

    Private Sub SerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived

       dataIn = SerialPort.ReadExisting

       SetText( dataIn)

    End Sub

     

    • Marked as answer by christing Monday, November 18, 2019 7:47 AM
    Monday, November 18, 2019 6:20 AM
  • @Viorel

    Thanks for your message i success get the data already. :)

    really thanks a lot

    Monday, November 18, 2019 7:47 AM
  • For problem services/utilities go to control-panel/administrator tools/event viewer/system/expand the tree/locate the time-date of the event/warning/properties/see what the OS says.For detailed help,go to Microsoft/TechNet errors.

    https://technet.microsoft.com/en-us/ms772425.aspx

    use the search settings & enter properties....

    Monday, November 18, 2019 5:20 PM