Click here to Skip to main content
16,006,535 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Character Movement Pin
Dalek Dave26-Nov-09 3:48
professionalDalek Dave26-Nov-09 3:48 
GeneralRe: Character Movement Pin
helelark12328-Nov-09 19:21
helelark12328-Nov-09 19:21 
GeneralRe: Character Movement Pin
Dalek Dave29-Nov-09 22:54
professionalDalek Dave29-Nov-09 22:54 
GeneralRe: Character Movement Pin
helelark1231-Dec-09 4:33
helelark1231-Dec-09 4:33 
Questioncustom date format script Pin
sfgman6325-Nov-09 21:55
sfgman6325-Nov-09 21:55 
AnswerRe: custom date format script Pin
Shameel25-Nov-09 23:33
professionalShameel25-Nov-09 23:33 
AnswerRe: custom date format script Pin
Steven J Jowett26-Nov-09 5:02
Steven J Jowett26-Nov-09 5:02 
QuestionLINQ query and DISPLAY ALL Pin
PAguilar0925-Nov-09 19:37
PAguilar0925-Nov-09 19:37 
I am currently trying to make a program that will read in a text file full of records and then allow the user to add or edit
the data. Basically like a database. Well i am trying to set up my queries right now, I am just trying to Sort by Last name and then display all the records in ascending order. the data is passed into 4 different text boxes though, one for FIRST NAME, LAST NAME, PHONE NUMBER, and GPA, SO when the user clicks a NEXT button he/she can view each record sorted by LAST NAME.

My problem i am having though is that when the user clicks the SORT by LAST NAME button it does sort but SPITS OUT THE LAST RECORD of the LIST instead of one at a time and then when he/she tries to click the NEXT BUTTON it just goes to End of File instead of showing the correct sorted list one at a time. CAN SOMEONE PLEASE TELL ME WHAT I AM LEAVING OUT OR NOT DOING RIGHT?

here is my sort routine:

Public Sub btnDisplaySorted_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplaySorted.Click

    Dim sortedLastName = From names In students Order By names.lastName Ascending Select names

    For Each element In sortedLastName

        txtFirstName.Text = element.firstName
        txtLastName.Text = element.lastName
        txtG.Text = element.gpa
        txtPhone.Text = element.tele

    Next

End Sub


and my Next button routine:

Public Structure student 'structure used to hold fields in student list
    Dim lastName As String
    Dim firstName As String
    Dim tele As String
    Dim gpa As Decimal
End Structure

'GLOBAL Variables needed for entire program
Public students As New List(Of student) 'create list of students
Public oneStudent As New student 'creates a place holder for one selected student


Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click

    Dim i As Integer

    For i = 0 To students.Count - 1
        Dim fname As String = students(i).firstName
        Dim lname As String = students(i).lastName
        txtFirstName.Text = fname
        txtLastName.Text = lname
        txtG.Text = oneStudent.gpa
        txtPhone.Text = oneStudent.tele
    Next i



End Sub

AnswerRe: LINQ query and DISPLAY ALL Pin
Wayne Gaylard26-Nov-09 1:51
professionalWayne Gaylard26-Nov-09 1:51 
GeneralRe: LINQ query and DISPLAY ALL Pin
PAguilar0927-Nov-09 6:21
PAguilar0927-Nov-09 6:21 
GeneralRe: LINQ query and DISPLAY ALL Pin
Wayne Gaylard27-Nov-09 7:22
professionalWayne Gaylard27-Nov-09 7:22 
GeneralRe: LINQ query and DISPLAY ALL Pin
PAguilar0929-Nov-09 18:39
PAguilar0929-Nov-09 18:39 
GeneralRe: LINQ query and DISPLAY ALL Pin
Wayne Gaylard29-Nov-09 19:08
professionalWayne Gaylard29-Nov-09 19:08 
QuestionFont Style Getting Error Pin
Anubhava Dimri25-Nov-09 17:44
Anubhava Dimri25-Nov-09 17:44 
AnswerRe: Font Style Getting Error Pin
Dave Kreskowiak26-Nov-09 4:31
mveDave Kreskowiak26-Nov-09 4:31 
GeneralRe: Font Style Getting Error Pin
Anubhava Dimri26-Nov-09 17:23
Anubhava Dimri26-Nov-09 17:23 
GeneralRe: Font Style Getting Error Pin
Dave Kreskowiak27-Nov-09 2:58
mveDave Kreskowiak27-Nov-09 2:58 
GeneralRe: Font Style Getting Error Pin
Anubhava Dimri27-Nov-09 17:09
Anubhava Dimri27-Nov-09 17:09 
Question[Message Deleted] Pin
siragl25-Nov-09 10:09
siragl25-Nov-09 10:09 
AnswerRe: Visual Basic .NET and SOAP Pin
Dave Kreskowiak25-Nov-09 13:23
mveDave Kreskowiak25-Nov-09 13:23 
GeneralRe: Visual Basic .NET and SOAP Pin
siragl25-Nov-09 21:04
siragl25-Nov-09 21:04 
GeneralRe: Visual Basic .NET and SOAP Pin
Dave Kreskowiak26-Nov-09 4:27
mveDave Kreskowiak26-Nov-09 4:27 
GeneralRe: Visual Basic .NET and SOAP Pin
siragl26-Nov-09 6:41
siragl26-Nov-09 6:41 
GeneralRe: Visual Basic .NET and SOAP Pin
Dave Kreskowiak26-Nov-09 8:04
mveDave Kreskowiak26-Nov-09 8:04 
AnswerRe: Visual Basic .NET and SOAP Pin
David Skelly25-Nov-09 22:30
David Skelly25-Nov-09 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.