erikson patar

erikson patar

  • NA
  • 1
  • 842

How to use property Tag for compare a value from database

Jan 15 2015 2:43 AM
Hallo brother, i want to learn c#.net ., please help me to fix the code ,The quetion is => ., how to use property Tag for compare a value from database???
 i use microsoft visual studio 2010
this project goal to make a Matching game picture

this is code from UI
<StackPanel Height="117" HorizontalAlignment="Left" Margin="6,23,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="136" Tap="stackpanel_Tap_1">
<Image Source="{Binding SOAL }" Name="Gambar1" Tag="{Binding ID_GAME}" />
</StackPanel>
 
 this is from class
This class i want to make prosedure(void) event click, in this void if i click a stackpanel i will get a ID_GAME, and then i click another stackpanel to compare the ID_GAME, if ID_GAME is match, it will be continue the game.

  private void stackpanel_Tap_1(object sender, GestureEventArgs e)
{
StackPanel firstklk = null;
StackPanel scndklk = null;
//Button btn = (Button)sender;
StackPanel Stn = (StackPanel)sender;


if (Stn != null)
{



if (firstklk == null)
{
Stn.Tag = this.Tag;

firstklk.Tag = Stn.Tag;



return;

}
scndklk.Tag= Stn.Tag;


if (firstklk.DataContext == scndklk.DataContext)
{
MessageBox.Show("MATCH");
}



}

else
{
MessageBox.Show(" Not Match ");
}


//MessageBox.Show("Succes");
}

 If You have another way to compare a value from database (web service), you can tell me the code?

Answers (1)