在任何给定时间我的应用程序都有两个打开的表单,我需要获取当前正在关注的表单名称以运行其他代码。我尝试使用下面的代码,但它不起作用。
var app = angular.module("myApp", ["ngCookies"]);
ngApp.factory("userPersistenceService", [
"$cookies", function($cookies) {
var userName = "";
return {
setCookieData: function(username) {
userName = username;
$cookies.put("userName", username);
},
getCookieData: function() {
userName = $cookies.get("userName");
return userName;
},
clearCookieData: function() {
userName = "";
$cookies.remove("userName");
}
}
}
]);
答案 0 :(得分:1)
使用属性Form.ActiveForm
。它会为您提供对当前有效表单https://msdn.microsoft.com/en-us/library/system.windows.forms.form.activeform%28v=vs.110%29.aspx
Dim afName As String = Form.ActiveForm.Name