以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]在状态栏显示农历时遇到闰年的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=71677)

--  作者:time
--  发布时间:2015/7/16 6:03:00
--  [求助]在状态栏显示农历时遇到闰年的问题

\'在状态栏显示用户名?表名?总行数?当前行位置,可以在SystemIdle中加入下面的代码:
With CurrentTable
    Dim Str1 As String =""
    Str1 = Str1 & " 今天是" & CLDate(Date.now)
    Str1 = Str1 & " " &  Format(Date.now,"dddd")
    Str1 = Str1 & " 农历" &  CLDate(New Lunar(Date.now).LunarDate)
\'2015年4月17日农历2015年2月29日,因为农历无此日,所以当天会无法进入系统 ,去除上行代码正常启动
    Str1 = Str1 & " 当前用户"& User.Name & "表名" & .Name & "总行数"
    Str1 = Str1 & .Rows.Count & "之" & (.Position + 1) & "行 "
    Str1 = Str1 & ""
    StatusBar.Message1 = Str1
End With

 

 

请问如何用正确的代码能在状态栏显示农历日期

 


--  作者:大红袍
--  发布时间:2015/7/16 9:38:00
--  

 要处理 一下

 

Dim dnow As Date = "2015-4-17"
Dim nd As Date
Dim str As String = New Lunar(dnow).LunarDate
If Date.TryParse(str, nd)
    msgbox(CLDate(nd))
Else
    nd = str.Replace("-2-", "-3-")
    msgbox(CLDate(nd).Replace("三月", "二月"))
End If


--  作者:time
--  发布时间:2015/7/17 13:21:00
--  

在SystemIdle中加入下面的代码

 

Dim dnow As Date = "2015-4-17"
Dim nd As Date
Dim str As String = New Lunar(dnow).LunarDate
If Date.TryParse(str, nd)
    msgbox(CLDate(nd))
Else
    nd = str.Replace("-2-", "-3-")
    msgbox(CLDate(nd).Replace("三月", "二月"))
End If

一直提示一个对话框导致无法进入数据库,请问上列代码应该放在哪个选项里面呀?
--  作者:大红袍
--  发布时间:2015/7/17 14:34:00
--  

汗,你能不能灵活变通啊.

 

With CurrentTable
    Dim Str1 As String =""
    Str1 = Str1 & " 今天是" & CLDate(Date.now)
    Str1 = Str1 & " " &  Format(Date.now,"dddd")
   
    Dim dnow As Date = Date.now
    Dim nd As Date
    Dim str As String = New Lunar(dnow).LunarDate
    If Date.TryParse(str, nd)
        Str1 = Str1 & " 农历" & CLDate(nd)
    Else
        nd = str.Replace("-2-", "-3-")
        Str1 = Str1 & " 农历" & CLDate(nd).Replace("三月", "二月")
    End If
    Str1 = Str1 & " 当前用户"& User.Name & "表名" & .Name & "总行数"
    Str1 = Str1 & .Rows.Count & "之" & (.Position + 1) & "行 "
    Str1 = Str1 & ""
    StatusBar.Message1 = Str1
End With