vb.net事件代理的简单介绍( 三 )


Console.WriteLine(" Stop Alarm? Enter Q")
Dim input As String = Console.ReadLine()
If input.Equals("Y") Or input.Equals("y") Then
Return
Else
If input.Equals("N") Or input.Equals("n") Then
CType(sender, AlarmClock).SnoozePressed = True
Return
Else
CType(sender, AlarmClock).Stop = True
Return
End If
End If
End If
Else
Console.WriteLine(" Let alarm ring? Enter Y")
Console.WriteLine(" Stop Alarm? Enter Q")
Dim input As String = Console.ReadLine()
If input.Equals("Y") Or input.Equals("y") Then
Return
Else
CType(sender, AlarmClock).Stop = True
Return
End If
End If
End Sub
End Class
' The driver class that hooks up the event handling method of
' WakeMeUp to the alarm event of an Alarm object using a delegate.
' In a forms-based application, the driver class is the
' form.
'
Public Class AlarmDriver
Public Shared Sub Main()
' Instantiates the event receiver.
Dim w As New WakeMeUp()
' Instantiates the event source.
Dim clock As New AlarmClock()
' Wires the AlarmRang method to the Alarm event.
AddHandler clock.Alarm, AddressOf w.AlarmRang
clock.Start()
End Sub
End Class
End Namespace
vb.net怎样设置ie浏览器的代理服务器地址建议vb.net事件代理你使用注册表vb.net事件代理的API进行修改
封装两个NET函数给vb.net事件代理你
private string GetReg(string RegPath)取得注册表项内容
{
string str="";
RegistryKey hkml = Registry.LocalMachine;
RegistryKey software = hkml.OpenSubKey("SOFTWARE",true);
RegistryKey aimdir = software.OpenSubKey("krabs",true);
if (aimdir != null)
{
if (aimdir.GetValue(RegPath) != null)
str = aimdir.GetValue(RegPath).ToString();
if (str != null)
return str;
return null;
}
return null;
}
private bool SetReg(string RegPath,string Data)//设置注册表内容
{
RegistryKey reg = Registry.LocalMachine;
RegistryKey software = reg.OpenSubKey("SOFTWARE", true);
RegistryKey aimdir1 = software.CreateSubKey("krabs");
if (aimdir1 == null)
return false;
aimdir1.SetValue(RegPath, Data);
return true;
}
【vb.net事件代理的简单介绍】关于vb.net事件代理和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

推荐阅读