X-Git-Url: https://fbox.kageds.com/gitweb/NEATEST.git/blobdiff_plain/599222942c6c954fb8eb161aade645f0c38c1a13..94fa2b4542b570f7a9206d1d38cbd5eb954edde4:/NEA/Store.xaml.vb?ds=inline diff --git a/NEA/Store.xaml.vb b/NEA/Store.xaml.vb index 86d563e..754a0af 100644 --- a/NEA/Store.xaml.vb +++ b/NEA/Store.xaml.vb @@ -1,6 +1,9 @@ -Public Class Store - Private Sub BtnSearch_Click(sender As Object, e As RoutedEventArgs) Handles btnSearch.Click - Dim id As String +Imports System.IO +Imports System.Drawing +Public Class Store + Dim id As String + Private Sub BtnSearch_Click(sender As Object, e As RoutedEventArgs) Handles btnsearch.Click + Dim ds As New NEADataSet Dim dr As System.Data.DataRow Dim da As New NEADataSetTableAdapters.GamesTableAdapter @@ -9,13 +12,13 @@ da.Fill(dt) For Each dr In dt.Rows If String.Compare(dr("Name"), txtSearch.Text) = 0 Then - MsgBox(txtSearch.Text & " was found in the database") + Dim Q As String = "[Name] = '" & txtSearch.Text & "'" Dim result() As NEADataSet.GamesRow = dt.Select(Q) id = result(0).GameID - MsgBox(ID) + GoTo LineBreak End If @@ -24,23 +27,30 @@ LineBreak: ds.Dispose() - Dim ds2 As New NEADataSet - Dim dr2 As System.Data.DataRow - Dim da2 As New NEADataSetTableAdapters.GamesTableAdapter - Dim dt2 As System.Data.DataTable - dt2 = ds2.Tables("Games") - da2.Fill(dt2) - For Each dr2 In dt2.Rows - String.Compare(dr2("GameID"), id) - MsgBox(txtSearch.Text & " was found in the database") + For Each dr In dt.Rows + If String.Compare(dr("GameID"), id) = 0 Then + txtname.AppendText(dr.Item("Name")) + + + Dim bytes As [Byte]() = dr.Item("Icon") + Dim ms As New MemoryStream(bytes) - GoTo LineBreak2 + Dim bi As New BitmapImage() + bi.BeginInit() + bi.StreamSource = ms + bi.EndInit() + + imglogo.Source = bi + End If Next - MsgBox("The game you entered is not in the database", vbExclamation) -LineBreak2: - ds2.Dispose() + End Sub + + Private Sub Button_Click(sender As Object, e As RoutedEventArgs) + Dim a As New AddGame() + a.Show() + End Sub End Class