Results 1 to 2 of 2

Thread: Bolding specific lines in textbox and indenting to the right side

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2013
    Posts
    16

    Bolding specific lines in textbox and indenting to the right side

    I am trying to bold just certain lines in the textbox, not all of the output. And also am trying to pad a couple of lines all the way to the far right of the textbox, not all of the lines, to make it look cleaner.

    I am trying to bold all of the (txtBoxCourse textboxes) and trying to indent all of the (txtBoxGrades textboxes) to the right.


    Code:
    Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
    
        Dim semester, Newline As String
        Dim totalGPA As Double = QualityPoints / txtBoxTotalHours.Text
    
        Newline = System.Environment.NewLine
        semester = CStr(txtBoxResults.Text)
        txtBoxTotalGPA.Text = CStr(totalGPA)
        txtBoxTotalGPA.Text = Math.Round(totalGPA, 3)
    
        If radButtonFall.Checked Then
    
            semester = "Fall"
    
        ElseIf radButtonSpring.Checked Then
    
            semester = "Spring"
    
        ElseIf radButtonSummer.Checked Then
    
            semester = "Summer"
    
        End If
    
    
        txtBoxResults.Text = (semester & " " & "Semester : ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & "Total Hours : " & txtBoxTotalHours.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & "Total Qualit Points : " & txtBoxTotalQualityPoints.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & "Total " & semester & " " & "GPA : " & txtBoxTotalGPA.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & "Enrolled Courses : ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse1.Text & "     " & txtBoxGrade1.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse2.Text & "     " & txtBoxGrade2.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse3.Text & "     " & txtBoxGrade3.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse4.Text & "     " & txtBoxGrade4.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse5.Text & "     " & txtBoxGrade5.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse6.Text & "     " & txtBoxGrade6.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse7.Text & "     " & txtBoxGrade7.Text)
        txtBoxResults.Text = (txtBoxResults.Text & Newline & " ")
        txtBoxResults.Text = (txtBoxResults.Text & Newline & txtBoxCourse8.Text & "     " & txtBoxGrade8.Text)
    
    End Sub
    Thanks for any help!

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Bolding specific lines in textbox and indenting to the right side

    TextBox control cannot display multi-formatted text, so use RichTextBox control instead, it enable you to show text with different fonts and colors.



Tags for this Thread

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