Click here to Skip to main content
15,919,613 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: C# to VB Adaption Problem Pin
Luc Pattyn1-Jan-12 3:47
sitebuilderLuc Pattyn1-Jan-12 3:47 
QuestionRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 3:59
Sonhospa1-Jan-12 3:59 
AnswerRe: C# to VB Adaption Problem Pin
Eddy Vluggen1-Jan-12 6:23
professionalEddy Vluggen1-Jan-12 6:23 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 6:34
Sonhospa1-Jan-12 6:34 
GeneralRe: C# to VB Adaption Problem Pin
Eddy Vluggen1-Jan-12 6:39
professionalEddy Vluggen1-Jan-12 6:39 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 6:58
Sonhospa1-Jan-12 6:58 
AnswerRe: C# to VB Adaption Problem Pin
Eddy Vluggen1-Jan-12 7:36
professionalEddy Vluggen1-Jan-12 7:36 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 7:53
Sonhospa1-Jan-12 7:53 
GeneralRe: C# to VB Adaption Problem Pin
Eddy Vluggen1-Jan-12 8:35
professionalEddy Vluggen1-Jan-12 8:35 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 12:16
Sonhospa1-Jan-12 12:16 
AnswerRe: C# to VB Adaption Problem Pin
Luc Pattyn1-Jan-12 12:33
sitebuilderLuc Pattyn1-Jan-12 12:33 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 12:51
Sonhospa1-Jan-12 12:51 
AnswerRe: C# to VB Adaption Problem Pin
Luc Pattyn1-Jan-12 12:58
sitebuilderLuc Pattyn1-Jan-12 12:58 
GeneralRe: C# to VB Adaption Problem Pin
Sonhospa1-Jan-12 13:14
Sonhospa1-Jan-12 13:14 
GeneralRe: C# to VB Adaption Problem Pin
Eddy Vluggen2-Jan-12 6:34
professionalEddy Vluggen2-Jan-12 6:34 
GeneralRe: C# to VB Adaption Problem Pin
Terence Wallace3-Jan-12 7:32
Terence Wallace3-Jan-12 7:32 
AnswerRe: C# to VB Adaption Problem with Lambda Expressions Pin
Simon_Whale2-Jan-12 12:33
Simon_Whale2-Jan-12 12:33 
GeneralRe: C# to VB Adaption Problem with Lambda Expressions Pin
Sonhospa9-Jan-12 23:09
Sonhospa9-Jan-12 23:09 
GeneralRe: C# to VB Adaption Problem with Lambda Expressions Pin
Simon_Whale9-Jan-12 23:12
Simon_Whale9-Jan-12 23:12 
AnswerRe: C# to VB Adaption Problem with Lambda Expressions Pin
Member 78595873-Jan-12 2:58
Member 78595873-Jan-12 2:58 
GeneralRe: C# to VB Adaption Problem with Lambda Expressions Pin
Sonhospa9-Jan-12 23:15
Sonhospa9-Jan-12 23:15 
AnswerRe: C# to VB Adaption Problem with Lambda Expressions Pin
Estys3-Jan-12 4:03
Estys3-Jan-12 4:03 
I always have trouble with anonymous delegates in VB so I factored them out :
VB
Class Program
    Shared worker As BackgroundWorker
    Public Shared Sub Main() 'ByVal args As String())
        worker = New BackgroundWorker()
        worker.WorkerReportsProgress = True
        AddHandler worker.DoWork, AddressOf DoWork
        AddHandler worker.ProgressChanged, AddressOf ProgressChanged
        worker.RunWorkerAsync()
        Console.Read()
    End Sub

    Private Shared Sub DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
        Dim items = Enumerable.Range(1, 1000)
        items.WithProgressReporting(AddressOf ReportProgress).ForEach(AddressOf DoSleep)
    End Sub
    Private Shared Sub ReportProgress(ByVal progress As Integer)
        worker.ReportProgress(progress)
    End Sub
    Private Shared Sub DoSleep(ByVal item As Integer)
        Thread.Sleep(10)
    End Sub
    Private Shared Sub ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
        Console.SetCursorPosition(1, 0)
        Console.Write(e.ProgressPercentage)
    End Sub
End Class


Cheers
GeneralRe: C# to VB Adaption Problem with Lambda Expressions Pin
Sonhospa9-Jan-12 23:19
Sonhospa9-Jan-12 23:19 
GeneralRe: C# to VB Adaption Problem with Lambda Expressions Pin
Estys9-Jan-12 23:50
Estys9-Jan-12 23:50 
AnswerRe: C# to VB Adaption Problem with Lambda Expressions Pin
DavidSherwood3-Jan-12 16:56
DavidSherwood3-Jan-12 16:56 

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.