Foxtable(狐表)用户栏目专家坐堂 → [求助]在状态栏显示农历时遇到闰年的问题


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

主题:[求助]在状态栏显示农历时遇到闰年的问题

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


加好友 发短信
等级:幼狐 帖子:142 积分:1649 威望:0 精华:0 注册:2014/5/3 14:52:00
[求助]在状态栏显示农历时遇到闰年的问题  发帖心情 Post By: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

 

 

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

 


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:142 积分:1649 威望:0 精华:0 注册:2014/5/3 14:52:00
  发帖心情 Post By: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

一直提示一个对话框导致无法进入数据库,请问上列代码应该放在哪个选项里面呀?

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By: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

 

 


 回到顶部