Foxtable(狐表)用户栏目专家坐堂 → 结果和我预想的不一样


  共有1669人关注过本帖树形打印复制链接

主题:结果和我预想的不一样

帅哥哟,离线,有人找我吗?
rjh4078
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3358 积分:24758 威望:0 精华:0 注册:2012/3/26 21:47:00
结果和我预想的不一样  发帖心情 Post By:2016/5/25 20:48:00 [只看该作者]

我在panel p1中动态添加了一组按钮 并在窗口click事件中加入下面代码

但是 只要单击panel就会触发按钮事件  怎么回事

 


For Each c As WinForm.Control In e.Form.Controls("p1").children    
    If Typeof c Is WinForm.button  AndAlso c.name.StartsWith("btn") Then
        Dim b As WinForm.button = c       
            ''MessageBox.show(c.name)
            Dim fl As String =  ProjectPath & "bin\temp\" &  b.text
            '' MessageBox.show(fl)
            If FileSys.FileExists(fl)  Then '如果本地存在同名文件且CRC校验值相同
                '则直接使用本地文件
            Else '否则从数据库提取文件
                Dim tj As String
                tj=c.name.Replace("btn-","")
                Dim dr As DataRow=DataTables("附件").sqlfind("uid='" & tj.Split("-")(0) & "' and 文件名='" & tj.Split("-")(1) & "'")
                If dr IsNot Nothing Then
                    If dr.SQLLoadFile("附件",fl) = True Then '如果提取文件失败
                        ''Messagebox.Show("附件提取失败,可能并不存在附件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                        Return
                    End If
                End If
            End If
            Dim Proc As New Process '打开文件
            Proc.File = fl
            Proc.Start()
       
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/25 20:51:00 [只看该作者]

 判断Click事件的 e.Sender 啊


 回到顶部