Results 1 to 9 of 9

Thread: Formatting

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    14

    Formatting

    Can someone just assist me with how to format this properly.
    My output is a little messed up in the Score and Grades section as shown
    Attachment 183095

    This is my code
    Code:
    lblResult.Text = "Acme University " & vbNewLine & _
    "IS122 Grade Sheet, 2021" & vbNewLine
    
    'print column headers
    lblResult.Text = lblResult.Text & _
    "-----------------------------------------------------------------------------" & _
    vbNewLine & _
    "ID#".PadRight(10) & "Name".PadRight(35) & "Score".PadRight(10) & "Grade" & _
    vbNewLine & _
    "-----------------------------------------------------------------------------" & _
    vbNewLine
    
    'now print the data from the table (structure array). No analysis is done here.
    
    Dim intKey, intStu, intSatexam As Integer
    Dim intPositionMatch As Integer
    Dim strC_ID, strC_Name, strC_Score, strC_Grade As String
    
    For intStu = 0 To My.Forms.frmMainMenu.intNumInClass - 1
    'get the row data from the array
    strC_ID = My.Forms.frmMainMenu.stdDetailsList(intStu).intID
    strC_Name = My.Forms.frmMainMenu.stdDetailsList(intStu).strLName & ", " & _
    My.Forms.frmMainMenu.stdDetailsList(intStu).strFName
    
    lblResult.Text = lblResult.Text & _
    strC_ID.PadRight(10) & _
    strC_Name.PadRight(35)
    
    intKey = My.Forms.frmMainMenu.stdDetailsList(intStu).intID
    intPositionMatch = -1
    For intSatexam = 0 To My.Forms.frmMainMenu.intNumSatTest - 1
    If intKey = My.Forms.frmMainMenu.stdResponsesList(intSatexam).intID Then
    intPositionMatch = intSatexam
    End If
    Next
    If intPositionMatch <> -1 Then
    
    strC_Score = My.Forms.frmMainMenu.stdResponsesList(intPositionMatch).dblScore.ToString()
    strC_Grade = My.Forms.frmMainMenu.stdResponsesList(intPositionMatch).strGrade
    
    lblResult.Text = lblResult.Text & _
    strC_Score.PadRight(10) & _
    strC_Grade & vbNewLine
    
    Else
    
    lblResult.Text = lblResult.Text & _
    "-".PadRight(10) & _
    "EX" & vbNewLine
    End If
    Next
    Last edited by dday9; Nov 23rd, 2021 at 08:20 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Formatting

    Check out this CodeBank thread of mine on the subject. If you expect text to line up then you have to use a fixed-width font, which it doesn't appear that you are. You may find that changing that is enough, but you should still use composite formatting rather than those padding methods anyway.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    14

    Re: Formatting

    Actually our specification stated to use padding functions which is why I needed to use that

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    24,507

    Re: Formatting

    You’ll still need to use a fixed width font, such as Lucida Console

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Formatting

    Please don't delete your original post. How does that help anyone? Any subsequent posts now have no context and anyone with a similar problem can't possibly be helped. What you should do is post your actual solution, if that is not covered by any of the replies, and then use the Thread Tools menu to mark the thread Resolved. That way, everyone can see the solution and improve on it if possible, plus no one has to open the thread to see that you don't need any further help.

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    14

    Re: Formatting

    Requesting for the post to be deleted

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Formatting

    Quote Originally Posted by priyenamishra View Post
    Requesting for the post to be deleted
    Requesting for the original question to be reinstated.

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    14

    Re: Formatting

    I was using this forum to clear my misunderstandings for my class activity, I do not want other students to copy my code. Apologies for any inconveniences caused. I can create a similar question to post later

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Formatting

    That seems fair enough. You're not going to get your thread deleted just by adding a post to it though. Only moderators can delete threads and there's a fair likelihood that they'll never see that post. The is a Report Post icon under each post that you can click to send a message to the mods and ask them to delete the thread and explain why. They may or may not comply, but if the original question has been removed then they may not see the point in keeping it around.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width