bool isLoginForm(object IeForm)
{
int i;
for (i=0;i<IeForm.Elements.Length;i++)
if (IeForm.Elements[i].Type.ToString().ToLower() == "password")
return true;
return false;
}if (ObjIe.Document.Frames.Length > 0)
{
for (i=0; i<ObjIe.Document.Frames.Length; i++)
{
ListFormsFormDoc(lstForm, ObjIe.Document.Frames[i].Document);
//lstForm.AddItem(frmAddSite.Web1.Document.Frames[i].Document.
//lstForm.AddItem(ObjIe.Document.Frames[i].Document.Title + i.ToString();
//ListFormFromDoc(lstForm, ObjIe.Document.Frames[i].Document);
}
}
else
{
//Type something here
}
{
int i;
for (i=0;i<IeForm.Elements.Length;i++)
if (IeForm.Elements[i].Type.ToString().ToLower() == "password")
return true;
return false;
}if (ObjIe.Document.Frames.Length > 0)
{
for (i=0; i<ObjIe.Document.Frames.Length; i++)
{
ListFormsFormDoc(lstForm, ObjIe.Document.Frames[i].Document);
//lstForm.AddItem(frmAddSite.Web1.Document.Frames[i].Document.
//lstForm.AddItem(ObjIe.Document.Frames[i].Document.Title + i.ToString();
//ListFormFromDoc(lstForm, ObjIe.Document.Frames[i].Document);
}
}
else
{
//Type something here
}
端代码
或HttpResponse.Write("<%Object.Document.Frames[]%>") ;
VB.NET对于一个类的实例是不检测成员是否存在的,尤其是像Object这种允许后期绑定的类型。当遇到Object.Document这种情况的时候,系统会要求CallByName,也就是用字符串的方式寻找这个Object实例的Document成员。
但是C#不一样,很多时候要求显式的进行类型转换,也就是说你必须转换成有这个成员的那个类型。比如sender就必须要通过((TextBox) sender).ReadOnly才能访问一个TextBox类型的sender实例的ReadOnly成员。不知道我这么说明不明白?问题是我不清楚你的IeForm和ObjIe应该是一个什么类,所以也没有办法给你写完全。我尽量给你查一下。