vb.net老黄历代码,vb代码黄色
VB.NET编写软件随开机启动代码
要设置软件随开机启动,可以这样写通过写入注册表,来达到你要的效果:
成都创新互联公司主要从事成都网站设计、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务马村,十年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575
在适当位置,插入如下代码:
Dim regname As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\microsoft\\windows\\currentversion\\run", True)
regname.SetValue("自己软件的名称", """" Application.StartupPath "\ 自己软件的名称.exe""")
你把:“自己软件的名称” 替换成自己的应用程序的名称!!
求计算二十四节气的VB代码
Private Function JieQi(TempDate As String) As String '计算节气
Dim S_Term(1 To 24) As String
Dim StInfo(1 To 24) As Long
Dim y As Integer, j As Integer, k As Integer
Dim E(1) As Double
Dim dtJ As Date
Dim strJm As String, strJd As String
Dim Strj As String '节气日期
'节气名
S_Term(1) = "小寒"
S_Term(2) = "大寒"
S_Term(3) = "立春"
S_Term(4) = "雨水"
S_Term(5) = "惊蛰"
S_Term(6) = "春分"
S_Term(7) = "清明"
S_Term(8) = "谷雨"
S_Term(9) = "立夏"
S_Term(10) = "小满"
S_Term(11) = "芒种"
S_Term(12) = "夏至"
S_Term(13) = "小暑"
S_Term(14) = "大署"
S_Term(15) = "立秋"
S_Term(16) = "处暑"
S_Term(17) = "白露"
S_Term(18) = "秋分"
S_Term(19) = "寒露"
S_Term(20) = "霜降"
S_Term(21) = "立冬"
S_Term(22) = "小雪"
S_Term(23) = "大雪"
S_Term(24) = "冬至"
'节气信息
StInfo(1) = 0
StInfo(2) = 21208
StInfo(3) = 42467
StInfo(4) = 63836
StInfo(5) = 85337
StInfo(6) = 107014
StInfo(7) = 128867
StInfo(8) = 150921
StInfo(9) = 173149
StInfo(10) = 195551
StInfo(11) = 218072
StInfo(12) = 240693
StInfo(13) = 263343
StInfo(14) = 285989
StInfo(15) = 308563
StInfo(16) = 331033
StInfo(17) = 353350
StInfo(18) = 375494
StInfo(19) = 397447
StInfo(20) = 419210
StInfo(21) = 440795
StInfo(22) = 462224
StInfo(23) = 483532
StInfo(24) = 504758
y = Val(Left(TempDate, 4)): j = Val(Mid(TempDate, 6, 2)): k = Val(Right(TempDate, 2))
If k = 15 Then
j = j * 2 - 1
Else
j = j * 2
End If
E(0) = (31556925.9747 * (y - 1900) + StInfo(j) * 60#)
E(1) = DateDiff("s", "1970-1-1 0:0", "1900-1-6 2:5") + E(0)
E(0) = E(1) / 2
dtJ = DateAdd("s", E(1) - E(0), DateAdd("s", E(0), "1970-1-1 1:18"))
dtJ = Year(dtJ) "-" Month(dtJ) "-" Day(dtJ)
If (Month(dtJ) 10) Then
strJm = "0" Month(dtJ)
Else
strJm = Month(dtJ)
End If
If (Day(dtJ) 10) Then
strJd = "0" Day(dtJ)
Else
strJd = Day(dtJ)
End If
Strj = Format(Year(dtJ) "-" strJm "-" strJd, "yyyy-mm-dd")
JieQi = ""
If DateDiff("d", Strj, TempDate) = -2 Then JieQi = "后天为" + S_Term(j) + "节气"
If DateDiff("d", Strj, TempDate) = -1 Then JieQi = "明天为" + S_Term(j) + "节气"
If Strj = TempDate Then JieQi = "今天是" + S_Term(j) + "节气"
End Function
VB.NET小白问题,求代码。。。
不知道你要干什么?是这样么?Public Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadTextBox1.Text = ""TextBox1.ReadOnly = TrueEnd SubPrivate Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClickTextBox1.Text = Val(TextBox1.Text) + 1End SubEnd Class
用vb.net编写记事本源代码
Dim sFileName As String
Dim Search
Private Sub dateTimeMenu_Click()
Text1.Text = Now
End Sub
Private Sub deleteMenu_Click()
Text1.Text = Left(Text1.Text, Text1.SelStart) + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub
Private Sub findMenu_Click()
Search = InputBox("请输入要查找的字词:")
Dim Where1 '获取需要查找的字符串变量
Text1.SetFocus '文本框获得焦点,以显示所找到的内容Search = InputBox("请输入要查找的字词:")
Where1 = InStr(Text1.Text, Search) '在文本中查找字符串
If Where1 Then
'若找到则设置选定的起始位置并使找到的字符串高亮
Text1.SelStart = Where1 - 1
Text1.SelLength = Len(Search)
' Me.Caption = Where1 '测试用
'否则给出提示
Else: MsgBox "未找到所要查找的字符串。", vbInformation, "提示"
End If
End Sub
Private Sub findNextMenu_Click()
Dim Where2
Dim StartMe As Integer '查找的起始位置变量
Text1.SetFocus '文本框获得焦点
StartMe = Text1.SelLength + Text1.SelStart + 1 '给变量赋值
Where2 = InStr(StartMe, Text1.Text, Search) '令其从上次找到的地方找起
If Where2 Then
Text1.SelStart = Where2 - 1
Text1.SelLength = Len(Search)
Else: MsgBox "未找到所要查找的字符串.", vbInformation, "提示"
End If
End Sub
Private Sub aboutMenu_Click()
MsgBox Space(2) "文本编辑器版本号1.0" Chr(13) "由西南财经大学天府学院" Chr(13) Space(5) "肖忠 开发" Chr(13) Space(2) "copyright:天府学院"
End Sub
Private Sub allMenu_Click()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub backcolorMenu_Click() '设置背景色代码
Form1.CommonDialog1.Action = 3
Text1.BackColor = Form1.CommonDialog1.Color
End Sub
Private Sub colorMenu_Click() '改变文字颜色代码
Form1.CommonDialog1.Action = 3
Text1.ForeColor = Form1.CommonDialog1.Color
End Sub
Private Sub cutMenu_Click()
Clipboard.SetText Text1.SelText
Text1.Text = Left(Text1.Text, Text1.SelStart) + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub
Private Sub exitMenu_Click()
End
End Sub
Private Sub fontMenu_Click() '字体菜单代码
Form1.CommonDialog1.Flags = 3 Or 256
Form1.CommonDialog1.Action = 4
If Len(Form1.CommonDialog1.FontName) = 0 Then
Form1.Text1.FontName = "宋体"
Else
Form1.Text1.FontName = Form1.CommonDialog1.FontName
End If
Form1.Text1.FontSize = Form1.CommonDialog1.FontSize
If Form1.CommonDialog1.FontBold = True Then
Form1.Text1.FontBold = True
Else
Form1.Text1.FontBold = False
End If
If Form1.CommonDialog1.FontItalic = True Then
Form1.Text1.FontItalic = True
Else
Form1.Text1.FontItalic = False
End If
Text1.ForeColor = Form1.CommonDialog1.Color
End Sub
Private Sub Form_Load()
Form1.Text1.Width = Form1.Width - 130
Form1.Text1.Height = Form1.Height
End Sub
Private Sub Form_Resize()
Form1.Text1.Width = Form1.Width - 130
Form1.Text1.Height = Form1.Height
End Sub
Private Sub help1Menu_Click()
Form1.CommonDialog1.HelpCommand = cdlHelpForceFile
Form1.CommonDialog1.HelpFile = "c:\windows\system32\winhelp.hlp"
CommonDialog1.ShowHelp
End Sub
Private Sub newMenu_Click()
If Len(Trim(Text1.Text)) = 0 Then
Form1.Caption = "我的记事本" "--" "未命名"
sFileName = "未命名"
Text1.FontSize = 15
Text1.FontName = "宋体"
Text1.Text = ""
Else
Call saveAsMenu_Click
Form1.Caption = "我的记事本" "--" "未命名"
sFileName = "未命名"
Text1.FontSize = 15
Text1.FontName = "宋体"
Text1.Text = ""
End If
End Sub
Private Sub openMenu_Click() '打开文件代码
If Len(Trim(Text1.Text)) = 0 Then
Form1.Caption = "我的记事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName) 0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption "--" Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋体"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
Else
Call saveAsMenu_Click
Form1.Caption = "我的记事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName) 0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption "--" Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋体"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
End If
End Sub
Private Sub pasteMenu_Click() '粘贴菜单代码
Text1.Text = Left(Text1.Text, Text1.SelStart) + Clipboard.GetText() + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub
Private Sub printMenu_Click()
Form1.CommonDialog1.ShowPrinter
For i = 1 To CommonDialog1.Copies
Printer.Print Text1.Text
Printer.Print Text1.Text
Next
Printer.EndDoc
End Sub
Private Sub saveAsMenu_Click() '另存为菜单代码
If Len(Trim(Text1.Text)) 0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName) 0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub saveMenu_Click()
If Len(Trim(Text1.Text)) 0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.FileName = "新建文本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName) 0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub statusMenu_Click()
End Sub
网站名称:vb.net老黄历代码,vb代码黄色
转载注明:http://pwwzsj.com/article/hosooh.html