大侠们,
我发布项目前运行正常,发布项目后这个窗体有问题
下面是出现问题的代码,附件中为错误提示。
注意:发布项目前是没问题的,发布项目后才出现的。
此主题相关图片如下:qq截图2.png
' 提取当天的年和月
Vars("y") = Date.today().year
Vars("m") = Date.today().month
e.Form.Controls("月").text = Vars("y") & "年" & format(Vars("m"),"00") & "月" '显示某年某月
e.Form.Controls("月1").text ="今天是:" & Date.today
Dim a As Date = "#" & Vars("m") & "/1/" & Vars("y") & "#" ' 定义当月的第一天 #10/1/2014#
Dim lb As WinForm.label
Dim lst As WinForm.ListView
' 定义农历的的月份称呼和日期称呼
Dim Month As String = "|正|二|三|四|五|六|七|八|九|十|冬|腊"
Dim Months() As String
Months = Month.split("|")
Dim Multi As String = "|初一|初二|初三|初四|初五|初六|初七|初八|初九|初十|十一|十二|十三|十四|"
Multi = Multi & "十五|十六|十七|十八|十九|廿十|廿一|廿二|廿三|廿四|廿五|廿六|廿七|廿八|廿九|卅十"
Dim Values() As String
Values = Multi.split("|")
For i As Integer = 1 To Date.DaysInMonth(Vars("y"),Vars("m")) ' 遍历当月的每一天
lb = e.Form.CreateControl(i & "日", ControlTypeEnum.label) ' 每一天增加一个标签
lb.Left =200*((i-1+a.DayOfWeek) Mod 7) '确定标签的大小和位置
lb.Top = 130*((i-1+a.DayOfWeek)\7)
lb.Width =198
lb.Height =16
Lst=e.Form.CreateControl("list" & i, ControlTypeEnum.ListView)
lst.left=200*((i-1+a.DayOfWeek) Mod 7)
lst.Top = 130*((i-1+a.DayOfWeek)\7)+16
lst.Width =198
lst.Height =110
Dim day As Date = "#" & Vars("m") & "/" & i & "/" & Vars("y") & "#" ' 定义当月的第一天 #10/1/2014#
Dim flt As String="开始日期 = #" & day & "#"
lst.StopRedraw() '停止绘制
lst.Groups.Clear() '清除原来的分组
lst.Columns.Clear() '清除原来的列
lst.Rows.Clear() '清除原来的行
lst.Images.Clear() '清除原来的图片
lst.View = ViewMode.Details '显示模式为详细信息
Dim cls() As String = {"任务ID","标题","分配给","状态"}
Dim wds() As Integer = {30,100,30,80} '定义列宽
For k As Integer = 0 To cls.Length - 1 '增加列
Dim c As WinForm.ListViewColumn = lst.Columns.Add()
c.Name = cls(k) '指定列名
c.Text = cls(k) '指定标题,这里标题和列名相同
c.Width = wds(k) '指定列宽
Next
Dim sl As List(of DataRow)=DataTables("任务表").Select(flt)
For Each dr As DataRow In sl
' Dim Key As String = dr("图标")
Dim r As WinForm.ListViewRow = lst.Rows.Add() '增加一行
' lvw.Images.AddImage(Key, Key & ".ico", Key & "48.ico") '添加代表这个国家的一对图标
' r.ImageKey = Key '指定图标键值
' r.Group = dr("洲") '指定所属分组
For Each cl As String In cls '逐列取值
r(cl) = dr(cl)
Next
Next
lst.ResumeRedraw() '恢复绘制
Dim nl As New Lunar("#" & Vars("m") & "/" & i & "/" & Vars("y") & "#")
' 设置月历的日期
If nl.day = 1
lb.BackColor = Color.plum
If nl.LeapMonth = Nothing OrElse nl.Month < nl.LeapMonth Then
lb.text = i & chr(32) & Months(nl.month) & "月"
End If
If nl.LeapMonth = nl.Month Then
lb.text = i & chr(32) & "闰" & Months(nl.month-1) & "月"
End If
If nl.LeapMonth > 0 Then
If nl.Month > nl.LeapMonth Then
lb.text = i & chr(32) & Months(nl.month-1) & "月"
End If
End If
Else
lb.text = i & chr(32) & Values(nl.Day)
lb.BackColor = Color.LightYellow
End If
' 星期六和星期天用红色标出.
If ((i-1+a.DayOfWeek) Mod 7) = 0 OrElse ((i-1+a.DayOfWeek) Mod 7) = 6
lb.ForeColor = Color.Red
End If
' 增加标签
e.Form.Controls("Panel1").AddControl(lb)
e.Form.Controls("Panel1").AddControl(lst)
lb.BorderStyle = System.Windows.Forms.BorderStyle.none
lb.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
lb.TopMost=True
lb.Cursor = Windows.Forms.Cursors.Hand
Next
' e.Form.Controls("label45").text = Format(Date.today(),"D") & " " & Format(Date.today(),"dddd")