Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


How Do I Get My Linq Statement To Give Me Different Results Displayed


How Do I Get My Linq Statement To Give Me Different Results Displayed

Author
Message
karodhill
karodhill
Forum God
Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)

Group: Forum Members
Posts: 2, Visits: 7
I have a linq statement where i turned letter grades into numbers to calculate a gpa can anyone tell me why no matter what grade i click i get the same gpa of 68 for each one? maybe someone can look over my code and give me an answer or hint thanks







Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click





Dim dic As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)

dic.Add("A", 4)

dic.Add("B", 3)

dic.Add("C", 2)

dic.Add("D", 1)

dic.Add("F", 0)



Dim gpa = Aggregate Grade In CoursesDataSet.tblCourses.AsEnumerable()

Select Grade.Field(Of Integer)("CreditHours") * dic(Grade.Field(Of String)("Grade"))

Into Sum()





MessageBox.Show("GPa:" & gpa.ToString("C2"),

"College Courses", MessageBoxButtons.OK,

MessageBoxIcon.Information)

End Sub



End Class

Joey
Joey
Forum God
Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)

Group: Forum Members
Posts: 72, Visits: 46
What do you mean no matter what grade you click? All I see is one button.
karodhill
karodhill
Forum God
Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)Forum God (494 reputation)

Group: Forum Members
Posts: 2, Visits: 7
There is a previous and next record button already coded
Joey
Joey
Forum God
Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)Forum God (9.3K reputation)

Group: Forum Members
Posts: 72, Visits: 46
Ok I see. Can you remove the table so we can see the code that's behind?
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search