PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Source Code/SingleScreen/frmMain.vb

#
Visual Basic | 41 lines | 27 code | 14 blank | 0 comment | 0 complexity | c39307c6d22dd4a58bc00a60be9033e4 MD5 | raw file
 1Imports PowerSong.SongDatabase.Items
 2Imports PowerSong.SongDatabase
 3
 4Public Class frmMain
 5
 6    Private _Database As Database = Nothing
 7
 8    Private _SelectedSong As SongItem = Nothing
 9
10    Private _ActiveVerseIndex As Integer = -1
11    
12    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
13        Me.Close()
14    End Sub
15
16    Private Sub frmMain_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
17
18        Try
19
20            If dlgSelectDatabase.ShowDialog = Windows.Forms.DialogResult.OK Then
21                _Database = Database.Load(dlgSelectDatabase.SelectedPath)
22            End If
23
24        Catch ex As Exception
25            MsgBox("Could not load the database:" + Environment.NewLine + ex.Message, MsgBoxStyle.Critical)
26        End Try
27
28    End Sub
29
30    Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
31
32        lstSearchResults.Visible = False
33        For Each SongID As Guid In _Database.SongIndex.FindSongs(txtSearch.Text)
34            Dim SongTitle As String = _Database.Songs.GetSongTitle(SongID)
35            lstSearchResults.Items.Add(SongTitle)
36        Next
37        lstSearchResults.Visible = True
38
39    End Sub
40
41End Class