Answered by:
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.

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 StringPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Private Sub SerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived
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
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
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
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.- Edited by Daniel_Zhang-MSFTMicrosoft contingent staff Monday, November 18, 2019 5:21 AM
-
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.
-
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
-
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....