Click here to Skip to main content
15,891,473 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do i store my font and return back. Pin
.NetRams16-Feb-07 22:30
.NetRams16-Feb-07 22:30 
AnswerRe: How do i store my font and return back. Pin
Dave Kreskowiak17-Feb-07 10:37
mveDave Kreskowiak17-Feb-07 10:37 
QuestionHow to use AddressOf with a Function in an API into VB.Net Pin
MammadAlimoradi16-Feb-07 22:04
MammadAlimoradi16-Feb-07 22:04 
AnswerRe: How to use AddressOf with a Function in an API into VB.Net Pin
Dave Kreskowiak17-Feb-07 10:33
mveDave Kreskowiak17-Feb-07 10:33 
QuestionHow do i know my control have Set BringtoFront? Pin
.NetRams16-Feb-07 21:57
.NetRams16-Feb-07 21:57 
AnswerRe: How do i know my control have Set BringtoFront? Pin
Dave Kreskowiak17-Feb-07 10:26
mveDave Kreskowiak17-Feb-07 10:26 
QuestionControls created on one thread cannot be parented to a control on a different thread. Pin
charchabil0316-Feb-07 20:39
charchabil0316-Feb-07 20:39 
AnswerRe: Controls created on one thread cannot be parented to a control on a different thread. [modified] Pin
TwoFaced16-Feb-07 22:15
TwoFaced16-Feb-07 22:15 
Setting 'CheckForIllegalCrossThreadCalls' to false won't help you in this case. I tried it myself and I get the same error you do. You could do that way if you were changing the text of a control or something like that, but I don't think you should use that method in any circumstances. I don't know that for sure but I would guess not using that method is the recommended way to go. Here is a procedure you can call to safely add a control to the collection of another from any thread.
Delegate Sub AddControlDelegate(ByVal parent As Control, ByVal child As Control)

'Safely adds any control to the collection of another
'parent: The control that is the container
'child:  The control to add
Private Sub AddControl(ByVal parent As Control, ByVal child As Control)
    If parent.InvokeRequired Then
        parent.Invoke(New AddControlDelegate(AddressOf AddControl), New Object() {parent, child})
    Else
        parent.Controls.Add(child)
    End If
End Sub
Now when you want to add your label you just use this procedure to safely do it from any thread you wish.
AddControl(me,lbl(Lindex))
For a more in depth tutorial on updating the UI from secondary threads you should read this article http://msdn.microsoft.com/msdnmag/issues/04/05/BasicInstincts/default.aspx[^] and/or search the web. For the moment though you just need to know my procedure works Smile | :)





-- modified at 4:38 Saturday 17th February, 2007
GeneralRe: Controls created on one thread cannot be parented to a control on a different thread. Pin
charchabil0317-Feb-07 6:09
charchabil0317-Feb-07 6:09 
QuestionAdding additional text to Dropdown list Pin
Praveen 12316-Feb-07 17:41
Praveen 12316-Feb-07 17:41 
QuestionCreating a new row. Pin
v45030516-Feb-07 15:09
v45030516-Feb-07 15:09 
AnswerRe: Creating a new row. Pin
_mubashir17-Feb-07 8:37
_mubashir17-Feb-07 8:37 
GeneralRe: Creating a new row. Pin
v45030518-Feb-07 4:45
v45030518-Feb-07 4:45 
AnswerRe: Creating a new row. Pin
GoodID19-Feb-07 22:49
GoodID19-Feb-07 22:49 
QuestionPopup dialog in a screensaver Pin
jim_taylor16-Feb-07 9:56
jim_taylor16-Feb-07 9:56 
Questionpdf read files Pin
haggenx16-Feb-07 8:11
haggenx16-Feb-07 8:11 
AnswerRe: pdf read files Pin
Dave Kreskowiak16-Feb-07 8:36
mveDave Kreskowiak16-Feb-07 8:36 
GeneralRe: pdf read files Pin
haggenx20-Feb-07 8:25
haggenx20-Feb-07 8:25 
AnswerRe: pdf read files Pin
KreativeKai16-Feb-07 9:17
professionalKreativeKai16-Feb-07 9:17 
AnswerRe: Calculating the number of days Pin
Stefan Troschuetz16-Feb-07 5:09
Stefan Troschuetz16-Feb-07 5:09 
Questionvb-com error 70 Pin
aamn116-Feb-07 2:28
aamn116-Feb-07 2:28 
AnswerRe: vb-com error 70 Pin
Dave Kreskowiak16-Feb-07 4:39
mveDave Kreskowiak16-Feb-07 4:39 
QuestionRe: vb-com error 70 Pin
aamn15-Mar-07 1:43
aamn15-Mar-07 1:43 
AnswerRe: vb-com error 70 Pin
Dave Kreskowiak5-Mar-07 3:09
mveDave Kreskowiak5-Mar-07 3:09 
GeneralRe: vb-com error 70 Pin
aamn15-Mar-07 18:14
aamn15-Mar-07 18:14 

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.