]> fbox.kageds.com Git - NEATEST.git/blob - NEA/Store.xaml.vb
Basic Store
[NEATEST.git] / NEA / Store.xaml.vb
1 Imports System.IO
2 Imports System.Drawing
3 Public Class Store
4 Dim id As String
5 Private Sub BtnSearch_Click(sender As Object, e As RoutedEventArgs) Handles btnsearch.Click
6
7 Dim ds As New NEADataSet
8 Dim dr As System.Data.DataRow
9 Dim da As New NEADataSetTableAdapters.GamesTableAdapter
10 Dim dt As System.Data.DataTable
11 Dim search As String
12 search = LCase(txtSearch.Text)
13 dt = ds.Tables("Games")
14 da.Fill(dt)
15 For Each dr In dt.Rows
16 If String.Compare(dr("Name"), search) = 0 Then
17 Dim Q As String = "[Name] = '" & search & "'"
18 Dim result() As NEADataSet.GamesRow = dt.Select(Q)
19 id = result(0).GameID
20 GoTo LineBreak
21 Else
22 MsgBox("The game you entered is not in the database", vbExclamation)
23 End If
24 Next
25
26 LineBreak:
27 ds.Dispose()
28 For Each dr In dt.Rows
29 If String.Compare(dr("GameID"), id) = 0 Then
30 txtname.AppendText(dr.Item("Name"))
31 btnBuy.Content = "Buy for £" & dr.Item("Price")
32 lblPublisher.Content = "Publisher: " & dr.Item("Publisher")
33 lblRating.Content = "This game is rated " & dr.Item("Rating") & " out of 5"
34 lblReviews.Content = "Gamer review: "
35 Dim bytes As [Byte]() = dr.Item("Icon")
36 Dim ms As New MemoryStream(bytes)
37 Dim bi As New BitmapImage()
38 bi.BeginInit()
39 bi.StreamSource = ms
40 bi.EndInit()
41 imgLogo.Source = bi
42 End If
43
44 Next
45 End Sub
46
47 Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
48 Dim a As New AddGame()
49 a.Show()
50
51 End Sub
52 End Class