Click here to Skip to main content
15,916,692 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: PowerPivot Pin
ThetaClear5-Nov-13 20:19
ThetaClear5-Nov-13 20:19 
Questionnew features in 2012 as compared to 2008 and 2010 Pin
SateeshVankayala4-Nov-13 0:57
SateeshVankayala4-Nov-13 0:57 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
thatraja4-Nov-13 1:21
professionalthatraja4-Nov-13 1:21 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Bernhard Hiller4-Nov-13 2:57
Bernhard Hiller4-Nov-13 2:57 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Abhinav S4-Nov-13 4:51
Abhinav S4-Nov-13 4:51 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Richard MacCutchan4-Nov-13 5:56
mveRichard MacCutchan4-Nov-13 5:56 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Shameel13-Nov-13 3:55
professionalShameel13-Nov-13 3:55 
NewsKeypress Event,vb.net Pin
srinivasankrishnaa2-Nov-13 22:23
srinivasankrishnaa2-Nov-13 22:23 
GeneralRe: Keypress Event,vb.net Pin
Richard MacCutchan3-Nov-13 1:29
mveRichard MacCutchan3-Nov-13 1:29 
GeneralRe: Keypress Event,vb.net Pin
Shameel13-Nov-13 3:57
professionalShameel13-Nov-13 3:57 
Questioncustom ribbons toggle button do not unchecked (default state) after checking it on mail send button click Pin
zakirhos2-Nov-13 20:36
zakirhos2-Nov-13 20:36 
AnswerRe: custom ribbons toggle button do not unchecked (default state) after checking it on mail send button click Pin
Dave Kreskowiak3-Nov-13 4:06
mveDave Kreskowiak3-Nov-13 4:06 
Questionnot getting it Pin
nissan12341-Nov-13 13:48
nissan12341-Nov-13 13:48 
AnswerRe: not getting it Pin
TnTinMn1-Nov-13 15:03
TnTinMn1-Nov-13 15:03 
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 

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.