您的位置:首页 > 编程语言 > VB

请您输入您的出生日期,下面的程序将您出生的是周几

2012-04-26 16:49 274 查看
        编写将出生日期转换为周几的程序
          通过编写这个程序我不仅知道自己是周几出生的,更重要的是我学到了vb知识,感觉挺有意思的,虽然编写过程挺难理解的,但我会一点点慢慢学习的。

       下面是编写过程:

Dim  Year as  Integer

Dim  Month as Integer

Dim  Day  as Integer

Dim Dayofweek as Byte

Dim  Birthday  as Date

Year=Int(Val(Text1.Text))

Month=Int(Val(Text2.Text))

Day=Int(Val(Text3.Text))

Birthday=Dateserial(Year,Month,Day)

Dayofweek=Weekday(Birthday)

Label6.caption=Weekdayname(n)

End sub

Private Function  Myweekdayname(Dayofweek  as  integer)as  string

    select case  n

          case  1

               Myweekdayname=“星期天”

           case  2

                Myweekdayname="非星期天"

   End   select

End Function

       通过对这个编程的编写我发现我对vb理解的太肤浅,需要认真的揣摩其中的细节,我要谨小慎微从小细节做起,是自己更好的应用这门学科。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐