Click here to Skip to main content
16,017,316 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: not getting it Pin
Abhinav S2-Nov-13 19:50
Abhinav S2-Nov-13 19:50 
Questiontext box,vb.net Pin
srinivasankrishnaa1-Nov-13 0:14
srinivasankrishnaa1-Nov-13 0:14 
AnswerRe: text box,vb.net Pin
TnTinMn1-Nov-13 17:33
TnTinMn1-Nov-13 17:33 
GeneralRe: text box,vb.net Pin
srinivasankrishnaa2-Nov-13 18:57
srinivasankrishnaa2-Nov-13 18:57 
QuestionReplacing one character instead of other,vb.net Pin
srinivasankrishnaa31-Oct-13 4:41
srinivasankrishnaa31-Oct-13 4:41 
AnswerRe: Replacing one character instead of other,vb.net Pin
Eddy Vluggen31-Oct-13 6:02
professionalEddy Vluggen31-Oct-13 6:02 
GeneralRe: Replacing one character instead of other,vb.net Pin
srinivasankrishnaa31-Oct-13 23:59
srinivasankrishnaa31-Oct-13 23:59 
Question[VB.NET 2008] How to write in a textbox from another thread Pin
steve_949661329-Oct-13 5:48
professionalsteve_949661329-Oct-13 5:48 
Hi everybody,
I have a simple project with a form and a class in another file to manage the COM port (from the article "Smart Device Print Engine for Compact Framework" by Orkun GEDiK).
I open the COM port and I start its thread for receiving data.
I want to write the received data in a textbox in the form.
To do this, every byte I receive, I assign the value of this byte to a byte variable of the form called byt and I call from inside the loop of the thread a function in the form that stores all the bytes in a string dati (in hexadecimal format):
VB
Public Sub ScriviTesto2()
  Dim str As String

  If InvokeRequired Then
    Invoke(New Action(AddressOf ScriviTesto2))
    Return
  End If

  Try
    str = Hex(byt)
    dati &= str & " "
  Catch ex As Exception
    MessageBox.Show(ex.ToString)
  End Try
End Sub

This seems to work because if I run the code step by step I see that the string dati grows byte by byte and contains the correct values.
When there are no more bytes to receive, always from inside the loop of the thread, I call another function of the form that should write my string in a text box:
VB
Public Sub ScriviTesto3()

  If InvokeRequired Then
    Invoke(New Action(AddressOf ScriviTesto3))
    Return
  End If

  TB1.Text &= dati & vbCrLf

End Sub

...this function write nothing in the text box... why?
The string data contains the right values, is not empty.

I tried another way: I don't call the last funcion (ScriviTesto3()) but, when there are no more bytes to receive, I click a button of the form that do the same:
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  TB1.Text &= dati & vbCrLf
End Sub

In this case, when I click the button the string dati is empty... I don't know why.

I add the declaration of the involved variables:
VB
Public Class Form1
  Public byt As Byte
  Protected dati As String
...


Can anyone help me?

Thanks in advance.
AnswerRe: [VB.NET 2008] How to write in a textbox from another thread Pin
Eddy Vluggen29-Oct-13 8:35
professionalEddy Vluggen29-Oct-13 8:35 
GeneralRe: [VB.NET 2008] How to write in a textbox from another thread Pin
steve_949661330-Oct-13 3:45
professionalsteve_949661330-Oct-13 3:45 
QuestionRe: [VB.NET 2008] How to write in a textbox from another thread Pin
Eddy Vluggen30-Oct-13 11:06
professionalEddy Vluggen30-Oct-13 11:06 
AnswerRe: [VB.NET 2008] How to write in a textbox from another thread Pin
steve_949661330-Oct-13 22:13
professionalsteve_949661330-Oct-13 22:13 
GeneralRe: [VB.NET 2008] How to write in a textbox from another thread Pin
Eddy Vluggen31-Oct-13 9:11
professionalEddy Vluggen31-Oct-13 9:11 
GeneralRe: [VB.NET 2008] How to write in a textbox from another thread Pin
steve_94966133-Nov-13 21:19
professionalsteve_94966133-Nov-13 21:19 
QuestionHow to read a text file containing Arabic chars in VB.Net 2005? Pin
dgthecodeproject29-Oct-13 1:51
dgthecodeproject29-Oct-13 1:51 
AnswerRe: How to read a text file containing Arabic chars in VB.Net 2005? Pin
Eddy Vluggen29-Oct-13 8:29
professionalEddy Vluggen29-Oct-13 8:29 
QuestionError with Assembly reference Pin
indian14328-Oct-13 7:43
indian14328-Oct-13 7:43 
AnswerRe: Error with Assembly reference Pin
Eddy Vluggen29-Oct-13 8:23
professionalEddy Vluggen29-Oct-13 8:23 
GeneralRe: Error with Assembly reference Pin
indian14329-Oct-13 13:21
indian14329-Oct-13 13:21 
GeneralRe: Error with Assembly reference Pin
Eddy Vluggen30-Oct-13 11:02
professionalEddy Vluggen30-Oct-13 11:02 
GeneralRe: Error with Assembly reference Pin
indian14331-Oct-13 6:48
indian14331-Oct-13 6:48 
GeneralRe: Error with Assembly reference Pin
Eddy Vluggen31-Oct-13 9:34
professionalEddy Vluggen31-Oct-13 9:34 
Question[VB.NET 2008] How to use DeviceIoControl function? Pin
steve_949661328-Oct-13 3:06
professionalsteve_949661328-Oct-13 3:06 
AnswerRe: [VB.NET 2008] How to use DeviceIoControl function? Pin
David Knechtges28-Oct-13 3:14
David Knechtges28-Oct-13 3:14 
GeneralRe: [VB.NET 2008] How to use DeviceIoControl function? Pin
steve_949661328-Oct-13 3:47
professionalsteve_949661328-Oct-13 3:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.