右键菜单版圣经vb.net加access

vbnet 复制代码
Imports System.Data.OleDb

Public Class Form1
    'Dim jiuyue As String() = {"创", "出", "利", "民", "申", "书", "士", "得", "撒上", "撒下", "王上", "王下", "代上", "代下", "拉", "尼", "斯", "伯", "诗", "箴", "传", "歌", "赛", "耶", "哀", "结", "但", "何", "珥", "摩", "俄", "拿", "弥", "鸿", "哈", "番", "该", "亚", "玛"}
    'Dim xinyue As String() = {"太", "可", "路", "约", "徒", "罗", "林前", "林后", "加", "弗", "腓", "西", "帖前", "帖后", "提前", "提后", "多", "门", "来", "雅", "彼前", "彼后", "约壹", "约贰", "约叁", "犹", "启"}
    Dim mulu As String() = {"律法书", "历史书", "诗歌·智慧书", "先知书", "四福音", "教会历史", "书信", "对约翰的启示"}

    Dim lfs As String() = {"创世记", "出埃及记", "利未记", "民数记", "申命记"}
    Dim lss As String() = {"约书亚记", "士师记", "路得记", "撒母耳记上", "撒母耳记下", "列王纪上", "列王纪下", "历代志上", "历代志下", "以斯拉记", "尼希米记", "以斯帖记"}
    Dim sgzhs As String() = {"约伯记", "诗篇", "箴言", "传道书", "雅歌"}
    Dim xzs As String() = {"以赛亚书", "耶利米书", "耶利米哀歌", "以西结书", "但以理书", "何西阿书", "约珥书", "阿摩司书", "俄巴底亚书", "约拿书", "弥迦书", "那鸿书", "哈巴谷书", "西番雅书", "哈该书", "撒迦利亚书", "玛拉基书"}
    Dim sfy As String() = {"马太福音", "马可福音", "路加福音", "约翰福音"}
    Dim jhls As String() = {"使徒行传"}
    Dim sx As String() = {"罗马书", "哥林多前书", "哥林多后书", "加拉太书", "以弗所书", "腓立比书", "歌罗西书", "帖撒罗尼迦前书", "帖撒罗尼迦后书", "提摩太前书", "提摩太后书", "提多书", "腓利门书", "希伯来书", "雅各书", "彼得前书", "彼得后书", "约翰一书", "约翰二书", "约翰三书", "犹大书"}
    Dim dyhdqs As String() = {"启示录"}

    Dim hb As String()() = {lfs, lss, sgzhs, xzs, sfy, jhls, sx, dyhdqs}
    'Dim tsl As ToolStripLabel = New ToolStripLabel("按f5全屏,esc退出全屏")

    Dim rtb As RichTextBox = New RichTextBox()
    Dim cms As ContextMenuStrip = New ContextMenuStrip()


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        rtb.Dock = DockStyle.Fill
        rtb.Font = New Font("黑体", 70, FontStyle.Bold)
        rtb.BackColor = Color.Black
        rtb.ReadOnly = True

        For i = 0 To hb.Length - 1
            Dim tsmi_mulu As ToolStripMenuItem = New ToolStripMenuItem(mulu(i))
            cms.Items.Add(tsmi_mulu)
            For j = 0 To hb(i).Length - 1
                Dim tsmi As ToolStripMenuItem = New ToolStripMenuItem(hb(i)(j))
                tsmi_mulu.DropDownItems.Add(tsmi)
                AddHandler tsmi.Click, AddressOf tsmiClick
            Next j
        Next i

        Me.WindowState = FormWindowState.Maximized
        rtb.ContextMenuStrip = cms
        Me.Controls.Add(rtb)
    End Sub

    Private Sub tsmiClick(sender As Object, e As EventArgs)
        Dim s As String = CType(sender, ToolStripMenuItem).Text
        selecthb(s)
    End Sub

    Private Sub selecthb(FullName As String)
        Dim s As String = InputBox("输入章节,中间用-分开", "输入章节,中间用-分开", "1-1")

        If s = Nothing Then
            Return
        ElseIf s.Equals("") Then
            Return
        End If

        Dim fenge As String() = s.Split("-")

        If fenge.Length < 2 Then
            Return
        End If

        If Not IsNumeric(fenge(0).Trim()) Or Not IsNumeric(fenge(1).Trim()) Then
            Return
        End If

        Me.rtb.Text = ""

        Using con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=bibleNosound.dat;Persist Security Info=True;Jet OLEDB:Database Password=pasitoldata")
            Using cmd As OleDbCommand = New OleDbCommand("select * from bible, bibleid where bible.VolumeSN = bibleid.SN and FullName = @FullName and ChapterSN = @ChapterSN and VerseSN >= @VerseSN", con)
                cmd.Parameters.AddWithValue("FullName", FullName)
                cmd.Parameters.AddWithValue("ChapterSN", fenge(0))
                cmd.Parameters.AddWithValue("VerseSN", fenge(1))
                con.Open()
                Using sdr As OleDbDataReader = cmd.ExecuteReader()
                    Dim i As Integer = 0
                    While sdr.Read()
                        If i Mod 3 = 0 Then
                            Me.rtb.SelectionColor = Color.Cyan
                        ElseIf i Mod 3 = 1 Then
                            Me.rtb.SelectionColor = Color.Magenta
                        Else
                            Me.rtb.SelectionColor = Color.Yellow
                        End If
                        Me.rtb.AppendText(sdr("ShortName") & ":" & sdr("ChapterSN") & ":" & sdr("VerseSN") & sdr("strjw") & Chr(13))
                        i += 1
                    End While
                End Using
            End Using
        End Using
        Me.rtb.Select(0, 0)
        Me.rtb.Focus()
    End Sub

End Class
相关推荐
明月看潮生3 分钟前
青少年编程与数学 02-007 PostgreSQL数据库应用 11课题、视图的操作
数据库·青少年编程·postgresql·编程与数学
阿猿收手吧!10 分钟前
【Redis】Redis入门以及什么是分布式系统{Redis引入+分布式系统介绍}
数据库·redis·缓存
奈葵13 分钟前
Spring Boot/MVC
java·数据库·spring boot
leegong2311122 分钟前
Oracle、PostgreSQL该学哪一个?
数据库·postgresql·oracle
中东大鹅27 分钟前
MongoDB基本操作
数据库·分布式·mongodb·hbase
夜光小兔纸1 小时前
Oracle 普通用户连接hang住处理方法
运维·数据库·oracle
兩尛2 小时前
订单状态定时处理、来单提醒和客户催单(day10)
java·前端·数据库
web2u3 小时前
MySQL 中如何进行 SQL 调优?
java·数据库·后端·sql·mysql·缓存
Elastic 中国社区官方博客3 小时前
使用 Elasticsearch 导航检索增强生成图表
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
小金的学习笔记4 小时前
RedisTemplate和Redisson的使用和区别
数据库·redis·缓存