Click here to Skip to main content
15,881,589 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What are some stupid-useful coding tricks you rely on? Pin
honey the codewitch9-Jan-23 5:18
mvahoney the codewitch9-Jan-23 5:18 
GeneralRe: What are some stupid-useful coding tricks you rely on? Pin
Gary Wheeler9-Jan-23 5:23
Gary Wheeler9-Jan-23 5:23 
GeneralRe: What are some stupid-useful coding tricks you rely on? Pin
honey the codewitch9-Jan-23 5:54
mvahoney the codewitch9-Jan-23 5:54 
AnswerRe: What are some stupid-useful coding tricks you rely on? Pin
Mircea Neacsu8-Jan-23 14:08
Mircea Neacsu8-Jan-23 14:08 
GeneralRe: What are some stupid-useful coding tricks you rely on? Pin
honey the codewitch8-Jan-23 14:53
mvahoney the codewitch8-Jan-23 14:53 
GeneralRe: What are some stupid-useful coding tricks you rely on? Pin
CPallini8-Jan-23 20:28
mveCPallini8-Jan-23 20:28 
AnswerRe: What are some stupid-useful coding tricks you rely on? Pin
Dan Sutton9-Jan-23 6:30
Dan Sutton9-Jan-23 6:30 
AnswerRe: What are some stupid-useful coding tricks you rely on? Pin
HappyDotNet10-Jan-23 5:01
professionalHappyDotNet10-Jan-23 5:01 
Use Background worker report progress to trigger different conditions on the main thread.
*** Ya Ya I know..background workers Dead | X| But I didn't architect the project Smile | :)

VB
Private Sub Go(myList as list(of String))
     bgw1.RunWorkerAsync(me,myList)
End Sub

Private Sub bgw1_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgw1.DoWork
  'background thread
   Dim myList As List(Of String) = e.Argument
   Dim listCount As Integer = myList.Count
   'long running process
   For i As Integer = 0 To listCount
      Dim resultInteger = DoWork(myList(i))
      bgw1.ReportProgress(resultInteger,myList(i))
   Next
End Sub

Private Sub bgw1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles bgw1.ProgressChanged
   'main thread
   Dim p As Integer = e.ProgressPercentage
   Dim s As String = CStr(e.UserState)
   Select Case P
     Case 1
       lbl1.Text = s
     Case 2
       lbl2.Text = s
     Case Else
       lbl1.Text = "Invalid Result for " & s
       lbl2.Text = "Invalid Result for " & s
   End Select
End Sub


modified 10-Jan-23 11:06am.

AnswerRe: What are some stupid-useful coding tricks you rely on? Pin
englebart21-Jan-23 9:29
professionalenglebart21-Jan-23 9:29 
AnswerRe: What are some stupid-useful coding tricks you rely on? Pin
FormerBIOSGuy26-Jan-23 6:13
FormerBIOSGuy26-Jan-23 6:13 
GeneralStrange RDP problem Pin
dandy728-Jan-23 4:33
dandy728-Jan-23 4:33 
GeneralRecursively Searching for "text" in files in windows 11 Pin
jmaida7-Jan-23 18:10
jmaida7-Jan-23 18:10 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
David O'Neil7-Jan-23 20:27
professionalDavid O'Neil7-Jan-23 20:27 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida8-Jan-23 13:16
jmaida8-Jan-23 13:16 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
David O'Neil8-Jan-23 13:26
professionalDavid O'Neil8-Jan-23 13:26 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida8-Jan-23 15:38
jmaida8-Jan-23 15:38 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Richard MacCutchan7-Jan-23 21:11
mveRichard MacCutchan7-Jan-23 21:11 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida8-Jan-23 13:27
jmaida8-Jan-23 13:27 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jschell10-Jan-23 7:37
jschell10-Jan-23 7:37 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
yacCarsten7-Jan-23 21:23
yacCarsten7-Jan-23 21:23 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Jacquers7-Jan-23 23:12
Jacquers7-Jan-23 23:12 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
BillWoodruff8-Jan-23 2:10
professionalBillWoodruff8-Jan-23 2:10 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida8-Jan-23 13:29
jmaida8-Jan-23 13:29 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
PIEBALDconsult8-Jan-23 3:28
mvePIEBALDconsult8-Jan-23 3:28 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Pete O'Hanlon8-Jan-23 4:07
mvePete O'Hanlon8-Jan-23 4:07 

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.