以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助窗口绑定目录树绑定Lable  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=23216)

--  作者:良才
--  发布时间:2012/9/6 7:52:00
--  求助窗口绑定目录树绑定Lable
 

Dim dt As DataTable = DataTables("在籍学生信息")
Dim Filter As String = "[班级] = \'" & e.Node.name & "\' And 学期 = \'" & e.Node.ParentNode.name & "\'"
Dim drs As List(of DataRow) = dt.Select(Filter,"")
For i As Integer = 0 To drs.Count - 1
    If e.Form.Controls.Contains("Lable" & i+1) Then
        e.Form.Controls("Lable" & i+1).text = drs(i)("姓名")
        e.Form.Controls("PictureBox" & i + 1).Image =  GetImage(drs(i)("照片"))
    End If
Next
For i As Integer = drs.Count To 7
    If e.Form.Controls.Contains("Lable" & i+1) Then
        e.Form.Controls("Lable" & i + 1).text = ""
        e.Form.Controls("PictureBox" & i + 1).Image = Nothing
    End If
Next

e.Form.Controls("Label1").text = drs.count
e.Form.Controls("Label2").text = dt.Compute("count(性别)",Filter & " And 性别 = \'男\'")
e.Form.Controls("Label3").text = dt.Compute("count(性别)",Filter & " And 性别 = \'女\'")


出现:

翻译错误:"Contains"不是"ControlCollection"的成员。

错误代码: If e.Form.Controls.Contains("Lable" & i+1) Then

请师傅指点


--  作者:狐狸爸爸
--  发布时间:2012/9/6 8:38:00
--  

Contains 不对,应该:

 
If e.Form.ExistControl("Lable" & i+1) Then

 

 

看看这里:
 
http://www.foxtable.com/help/topics/1409.htm


 


--  作者:良才
--  发布时间:2012/9/7 7:36:00
--  

 

Dim dt As DataTable = DataTables("在籍学生信息")
Dim Filter As String = "[班级] = \'" & e.Node.name & "\' And 学期 = \'" & e.Node.ParentNode.name & "\'"
Dim drs As List(of DataRow) = dt.Select(Filter,"")
For i As Integer = 0 To drs.Count - 1
    If e.Form.Controls.Contains("Lable" & i+1) Then
        e.Form.Controls("Lable" & i+1).text = drs(i)("姓名")
        e.Form.Controls("PictureBox" & i + 1).Image =  GetImage(drs(i)("照片"))
    End If
Next
For i As Integer = drs.Count To 7
    If e.Form.Controls.Contains("Lable" & i+1) Then
        e.Form.Controls("Lable" & i + 1).text = ""
        e.Form.Controls("PictureBox" & i + 1).Image = Nothing
    End If
Next

e.Form.Controls("Label1").text = drs.count
e.Form.Controls("Label2").text = dt.Compute("count(性别)",Filter & " And 性别 = \'男\'")
e.Form.Controls("Label3").text = dt.Compute("count(性别)",Filter & " And 性别 = \'女\'")


出现:

翻译错误:"Contains"不是"ControlCollection"的成员。

错误代码: If e.Form.Controls.Contains("Lable" & i+1) Then

请师傅指点

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.zip


--  作者:狐狸爸爸
--  发布时间:2012/9/7 9:02:00
--  

Dim dt As DataTable = DataTables("在籍学生信息")
Dim Filter As String = "[班级] = \'" & e.Node.name & "\' And 学期 = \'" & e.Node.ParentNode.name & "\'"
Dim drs As List(of DataRow) = dt.Select(Filter,"")
For i As Integer = 0 To drs.Count - 1
    If e.Form.ExistControl("Lable" & i+1) Then
        e.Form.Controls("Lable" & i+1).text = drs(i)("姓名")
        e.Form.Controls("PictureBox" & i + 1).Image =  GetImage(drs(i)("照片"))
    End If
Next
For i As Integer = drs.Count To 7
    If e.Form.ExistControl("Lable" & i+1) Then
        e.Form.Controls("Lable" & i + 1).text = ""
        e.Form.Controls("PictureBox" & i + 1).Image = Nothing
    End If
Next

e.Form.Controls("Label1").text = drs.count
e.Form.Controls("Label2").text = dt.Compute("count(性别)",Filter & " And 性别 = \'男\'")
e.Form.Controls("Label3").text = dt.Compute("count(性别)",Filter & " And 性别 = \'女\'")