Jump to content

Showing Active Player


chapperzUK

Recommended Posts

How do you show can active player's information?

I have this code but it has errors (in red) and I'm not sure if it works.

Private Sub btnActive_Click(ByVal sender As Object, ByVal e As EventArgs)
       Dim filter As IEnumerable(Of Player) = fmDataContext.Players
       Dim player As Player = DirectCast(fmDataContext.ActiveObject, Player)

       If player IsNot Nothing Then
           filter = filter.Where(Function(p) p.ID.Equals(player.ID))

           gridPlayers.AutoGenerateColumns = True

gridPlayers.DataSource = (From p In filter Select New _
           [color="red"][b]ID [/b][/color]= player.ID _
           [b][color="red"]FullName [/color][/b]= player.ToString() _
           NickName = player.Nickname _
           CA = player.CurrentPlayingAbility _
           PA = player.PotentialPlayingAbility _
           Age = player.Age _
           Value = String.Format("{0:€ #,##0;(€ #,##0)}", player.Value) _
           SaleValue = String.Format("{0:€ #,##0;(€ #,##0)}", player.SaleValue)
       End If
txtPlayerCorners.Text = ([color="Red"][b]currentPlayer[/b][/color].TechnicalSkills.Corners / 5).ToString();
   End Sub

Any help would be appreciated and you can be credited in the final piece. You can either PM me or email me.

Link to post
Share on other sites

A little more info will be of help, or try programmers oracle in the main community section. I know a bit about stuff, what are you trying to get to talk in what? ( i am rather bemused by this, I am only an intermediate programmer with VB, SQL and HTML)

http://community.sigames.com/forumdisplay.php?f=11

Link to post
Share on other sites

How do you show can active player's information?

I have this code but it has errors (in red) and I'm not sure if it works.

Private Sub btnActive_Click(ByVal sender As Object, ByVal e As EventArgs)
       Dim filter As IEnumerable(Of Player) = fmDataContext.Players
       Dim player As Player = DirectCast(fmDataContext.ActiveObject, Player)

       If player IsNot Nothing Then
           filter = filter.Where(Function(p) p.ID.Equals(player.ID))

           gridPlayers.AutoGenerateColumns = True

gridPlayers.DataSource = (From p In filter Select New _
           [color=red][b]ID [/b][/color]= player.ID _
           [b][color=red]FullName [/color][/b]= player.ToString() _
           NickName = player.Nickname _
           CA = player.CurrentPlayingAbility _
           PA = player.PotentialPlayingAbility _
           Age = player.Age _
           Value = String.Format("{0:€ #,##0;(€ #,##0)}", player.Value) _
           SaleValue = String.Format("{0:€ #,##0;(€ #,##0)}", player.SaleValue)
       End If
txtPlayerCorners.Text = ([color=red][b]currentPlayer[/b][/color].TechnicalSkills.Corners / 5).ToString();
   End Sub

Any help would be appreciated and you can be credited in the final piece. You can either PM me or email me.

Using the FM Framework:

In your button click event use this:

If TypeOf (fmDataContext.ActiveObject) Is Player Then

' Details

Me.lblName.Text = DirectCast(fmDataContext.ActiveObject, Player).ToString()

Me.lblClub.Text = DirectCast(fmDataContext.ActiveObject, Player).Team.Club.Name

Me.lblAge.Text = DirectCast(fmDataContext.ActiveObject, Player).Age.ToString

Me.dtpDOB.Value = DirectCast(fmDataContext.ActiveObject, Player).DateOfBirth.ToShortDateString

Me.lblCityofBirth.Text = DirectCast(fmDataContext.ActiveObject, Player).CityOfBirth.Name

Me.numHapiness.Value = DirectCast(fmDataContext.ActiveObject, Player).Contract.Happiness

Me.mtxtIntCaps.Text = DirectCast(fmDataContext.ActiveObject, Player).InternationalCaps.ToString

Me.mtxtIntGoals.Text = DirectCast(fmDataContext.ActiveObject, Player).InternationalGoals.ToString

Me.mtxtU21Caps.Text = DirectCast(fmDataContext.ActiveObject, Player).U21InternationalCaps

Me.mtxtU21Goals.Text = DirectCast(fmDataContext.ActiveObject, Player).U21InternationalGoals

End If

Link to post
Share on other sites

Where is the source?

You need to download the source by using a subversion client. I use Tortoise http://tortoisesvn.net/.

When you have that installed, in Windows Explorer with a folder where you want the source code checked out to, right click and select SVN Checkout and the URL will be http://scoutframeworkfm2009.googlecode.com/svn/trunk/.

The source code will then be checked out, and you can then open up in VS.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...