Click here to Skip to main content
11,581,982 members (78,479 online)

.NET Framework

 
AnswerRe: estoy tratando de compilar un archivo.mex a .net Pin
Eddy Vluggen19-Nov-12 11:09
memberEddy Vluggen19-Nov-12 11:09 
GeneralRe: estoy tratando de compilar un archivo.mex a .net Pin
IdeasPravinh23-Nov-12 23:47
memberIdeasPravinh23-Nov-12 23:47 
AnswerRe: estoy tratando de compilar un archivo.mex a .net Pin
Bernhard Hiller19-Nov-12 22:35
memberBernhard Hiller19-Nov-12 22:35 
GeneralRe: estoy tratando de compilar un archivo.mex a .net Pin
yeyomax20-Nov-12 5:25
memberyeyomax20-Nov-12 5:25 
GeneralRe: estoy tratando de compilar un archivo.mex a .net Pin
Dave Kreskowiak20-Nov-12 6:11
mvpDave Kreskowiak20-Nov-12 6:11 
Question[VB.NET 2008] Change form from separate thread (Windows CE) Pin
Member 949661319-Nov-12 2:51
memberMember 949661319-Nov-12 2:51 
AnswerRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Simon_Whale19-Nov-12 3:04
memberSimon_Whale19-Nov-12 3:04 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
steve_949661319-Nov-12 4:37
membersteve_949661319-Nov-12 4:37 
AnswerRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Eddy Vluggen19-Nov-12 5:04
memberEddy Vluggen19-Nov-12 5:04 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
steve_949661319-Nov-12 22:54
membersteve_949661319-Nov-12 22:54 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Eddy Vluggen20-Nov-12 0:53
memberEddy Vluggen20-Nov-12 0:53 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
steve_949661320-Nov-12 3:36
membersteve_949661320-Nov-12 3:36 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Eddy Vluggen20-Nov-12 4:33
memberEddy Vluggen20-Nov-12 4:33 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
steve_949661320-Nov-12 5:23
membersteve_949661320-Nov-12 5:23 
Here is the code (the code is in two files: one for Form1 and one for MyThread):

Imports System.Threading
 
Public Class Form1
  Dim MyNewThread As Thread
 
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'create the thread 
    MyNewThread = New Thread(AddressOf MyThread.MyThreadExecute)
    MyNewThread.Name = "NuovoThread"
    'start the thread
    MyNewThread.Start()   'no "Me" parameter
  End Sub
 
  Public Sub AggiornaLabel(ByVal What As String)
    If InvokeRequired Then
      Invoke(New Action(Of String)(AddressOf AggiornaLabel), New Object() {What})
      Return
    End If
 
    Label1.Text = What
  End Sub
 
End Class
 

Public Class MyThread
  Private Shared miii As Int32 = 0
 
  Public Shared Property iii() As Int32
    Get
      Return miii
    End Get
    Set(ByVal value As Int32)
      miii = value
    End Set
  End Property
 
  Public Shared Sub MyThreadExecute(ByVal Origin As Object)
  'Public Shared Sub MyThreadExecute()
    Dim OriginForm As Form1 = CType(Origin, Form1)
    'Dim OriginForm As Form1 = New Form1()
    Do
      iii = iii + 1
      OriginForm.AggiornaLabel(iii.ToString)
      Thread.Sleep(100)
    Loop
  End Sub
End Class
 

if I remove the "origin" parameter as in the commented lines in the code above the error disappears and I can run the application on the device but the label is not updated because the condition "If InvokeRequired Then" is alwais false (as it was in the first example I posted).
Perhaps I have not removed the "origin" parameter in a consistent manner (I have more then one doubt about the line "Dim OriginForm As Form1 = New Form1()"...)

About passing a parameter in an object when I start the thread, I can't do this because in the Compact Framework (not the full .NET) only the method Thread.Start() is supported, the method Thread.Start(Object) is not supported.
Perhaps this is another reason why the code doesnt work: the MyThreadExecute-method has no "connection" with Form1 and so in Form1 InvokeRequired is false.

ps: I thank you for your patience...
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Eddy Vluggen20-Nov-12 9:21
memberEddy Vluggen20-Nov-12 9:21 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
steve_949661320-Nov-12 21:25
membersteve_949661320-Nov-12 21:25 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pin
Eddy Vluggen21-Nov-12 5:07
memberEddy Vluggen21-Nov-12 5:07 
QuestionBinding gridview from webservice using jquery Pin
saravanan2509218-Nov-12 20:41
membersaravanan2509218-Nov-12 20:41 
AnswerRe: Binding gridview from webservice using jquery Pin
Phanindra26119-Nov-12 6:05
memberPhanindra26119-Nov-12 6:05 
QuestionNlog for .Net compact Pin
TalSt17-Nov-12 19:24
memberTalSt17-Nov-12 19:24 
AnswerRe: Nlog for .Net compact Pin
Richard MacCutchan17-Nov-12 21:43
mvpRichard MacCutchan17-Nov-12 21:43 
GeneralRe: Nlog for .Net compact Pin
TalSt18-Nov-12 1:15
memberTalSt18-Nov-12 1:15 
GeneralRe: Nlog for .Net compact Pin
Richard MacCutchan18-Nov-12 1:36
mvpRichard MacCutchan18-Nov-12 1:36 
GeneralRe: Nlog for .Net compact Pin
TalSt18-Nov-12 1:55
memberTalSt18-Nov-12 1:55 
GeneralRe: Nlog for .Net compact Pin
Richard MacCutchan18-Nov-12 2:06
mvpRichard MacCutchan18-Nov-12 2:06 
AnswerRe: Nlog for .Net compact Pin
jschell19-Nov-12 9:11
memberjschell19-Nov-12 9:11 
GeneralRe: Nlog for .Net compact Pin
TalSt28-Jan-15 19:02
memberTalSt28-Jan-15 19:02 
News.NET projects in koramangala,bangalore Pin
raji.1138716-Nov-12 22:24
memberraji.1138716-Nov-12 22:24 
News2013 final year IEEE projects Pin
raji.1138716-Nov-12 22:20
memberraji.1138716-Nov-12 22:20 
QuestionWebsite Developemnt Pin
radha123 from Hyderabad15-Nov-12 1:39
memberradha123 from Hyderabad15-Nov-12 1:39 
AnswerRe: Website Developemnt Pin
Richard MacCutchan15-Nov-12 2:41
mvpRichard MacCutchan15-Nov-12 2:41 
GeneralRe: Website Developemnt Pin
Pete O'Hanlon15-Nov-12 3:00
protectorPete O'Hanlon15-Nov-12 3:00 
GeneralRe: Website Developemnt Pin
Richard MacCutchan15-Nov-12 4:12
mvpRichard MacCutchan15-Nov-12 4:12 
GeneralRe: Website Developemnt Pin
Paul Conrad15-Nov-12 10:37
memberPaul Conrad15-Nov-12 10:37 
AnswerRe: Website Developemnt Pin
jschell15-Nov-12 8:07
memberjschell15-Nov-12 8:07 
GeneralRe: Website Developemnt Pin
dojohansen20-Nov-12 6:02
memberdojohansen20-Nov-12 6:02 
AnswerRe: Website Developemnt Pin
Zaf Khan19-Nov-12 17:24
memberZaf Khan19-Nov-12 17:24 
Questionis Windows-8 can run Webservice that work with FrameWork3.5? Pin
goldsoft11-Nov-12 9:08
membergoldsoft11-Nov-12 9:08 
AnswerRe: is Windows-8 can run Webservice that work with FrameWork3.5? Pin
n.podbielski13-Nov-12 21:08
membern.podbielski13-Nov-12 21:08 
QuestionSpeech Recognition (System.speech) Pin
saurabh orange vyas10-Nov-12 0:10
membersaurabh orange vyas10-Nov-12 0:10 
AnswerRe: Speech Recognition (System.speech) Pin
Eddy Vluggen10-Nov-12 7:19
memberEddy Vluggen10-Nov-12 7:19 
GeneralRe: Speech Recognition (System.speech) Pin
saurabh orange vyas10-Nov-12 21:15
membersaurabh orange vyas10-Nov-12 21:15 
GeneralRe: Speech Recognition (System.speech) Pin
Richard MacCutchan10-Nov-12 21:31
mvpRichard MacCutchan10-Nov-12 21:31 
GeneralRe: Speech Recognition (System.speech) Pin
saurabh orange vyas10-Nov-12 21:49
membersaurabh orange vyas10-Nov-12 21:49 
GeneralRe: Speech Recognition (System.speech) Pin
Richard MacCutchan10-Nov-12 22:11
mvpRichard MacCutchan10-Nov-12 22:11 
GeneralRe: Speech Recognition (System.speech) Pin
saurabh orange vyas10-Nov-12 22:15
membersaurabh orange vyas10-Nov-12 22:15 
GeneralRe: Speech Recognition (System.speech) Pin
Richard MacCutchan10-Nov-12 22:29
mvpRichard MacCutchan10-Nov-12 22:29 
GeneralRe: Speech Recognition (System.speech) Pin
saurabh orange vyas10-Nov-12 22:47
membersaurabh orange vyas10-Nov-12 22:47 
GeneralRe: Speech Recognition (System.speech) Pin
Richard MacCutchan11-Nov-12 0:53
mvpRichard MacCutchan11-Nov-12 0:53 
GeneralRe: Speech Recognition (System.speech) Pin
saurabh orange vyas11-Nov-12 1:01
membersaurabh orange vyas11-Nov-12 1:01 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 6 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid