-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfrmBTOBirdNameMatch.vb
103 lines (81 loc) · 3.09 KB
/
frmBTOBirdNameMatch.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Imports System.IO
Imports System.Data.SQLite
Public Class frmBTOBirdNameMatch
Private strG21CommonName As String
Public Property G21CommonName() As String
Get
Return strG21CommonName
End Get
Set(ByVal value As String)
strG21CommonName = value
lblG21CommonName.Text = value
InitValues()
End Set
End Property
Private strG21ScientificName As String
Public Property G21ScientificName() As String
Get
Return strG21ScientificName
End Get
Set(ByVal value As String)
strG21ScientificName = value
lblG21ScientificName.Text = value
InitValues()
End Set
End Property
Private Sub InitValues()
strBTOCommonName = ""
strBTOScientificName = ""
cboCommonName.SelectedIndex = -1
cboScientificName.SelectedIndex = -1
End Sub
Private strBTOCommonName As String
Public ReadOnly Property BTOCommonName() As String
Get
Return strBTOCommonName
End Get
End Property
Private strBTOScientificName As String
Public ReadOnly Property BTOScientificName() As String
Get
Return strBTOScientificName
End Get
End Property
Private Sub PopulateBTONames()
Dim strResourcesDB As String = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "g21resources.db3")
Dim conResources As SQLiteConnection = New SQLiteConnection("Data Source=" & strResourcesDB)
Dim strSQL As String = "Select ScientificName, CommonName from BTOBirdNames;"
Dim da As SQLiteDataAdapter = New SQLiteDataAdapter(strSQL, conResources)
Dim dt As DataTable = New DataTable()
da.Fill(dt)
cboCommonName.DisplayMember = "CommonName"
cboCommonName.ValueMember = "ScientificName"
cboCommonName.DataSource = dt
cboScientificName.DisplayMember = "ScientificName"
cboScientificName.ValueMember = "CommonName"
cboScientificName.DataSource = dt
cboCommonName.SelectedIndex = -1
cboScientificName.SelectedIndex = -1
End Sub
Private Sub frmBTOBirdNameMatch_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If cboCommonName.DisplayMember = "" Then
PopulateBTONames()
End If
End Sub
Private Sub butOK_Click(sender As System.Object, e As System.EventArgs) Handles butOK.Click
strBTOCommonName = cboCommonName.Text
strBTOScientificName = cboScientificName.Text
Me.Close()
End Sub
Private Sub butCancel_Click(sender As System.Object, e As System.EventArgs) Handles butCancel.Click
strBTOCommonName = ""
strBTOScientificName = ""
Me.Close()
End Sub
Private Sub cboCommonName_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboCommonName.SelectedIndexChanged
butOK.Focus()
End Sub
Private Sub frmBTOBirdNameMatch_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
cboCommonName.Focus()
End Sub
End Class