注册 登录
编程论坛 VB.NET论坛

Address of 使用请教

jack_xu2046 发布于 2010-12-07 10:11, 1096 次点击
Public Sub CountSheep()
    Dim i As Integer = 1 ' Sheep do not count from 0.
    Do While (True) ' Endless loop.
        Console.WriteLine("Sheep " & i & " Baah")
        i = i + 1
        System.Threading.Thread.Sleep(1000) 'Wait 1 second.
    Loop
End Sub

Sub UseThread()
    Dim t As New System.Threading.Thread(AddressOf CountSheep)
    t.Start()
End Sub

请问此处怎么将CountSheep这个方法的过程直接放到AddressOf  后面


因为在C#中   有这段例子
private void Log(LogMsgType msgtype, string msg)
    {
      rtfTerminal.Invoke(new EventHandler(delegate
      {
        rtfTerminal.SelectedText = string.Empty;
        rtfTerminal.SelectionFont = new Font(rtfTerminal.SelectionFont, FontStyle.Bold);
        rtfTerminal.SelectionColor = LogMsgTypeColor[(int)msgtype];
        rtfTerminal.AppendText(msg);
        rtfTerminal.ScrollToCaret();
      
}));
    }
不知在如何写。
1 回复
#2
jack_xu20462010-12-08 07:35
delegate{}这一段可以用什么替代?
1