How to change Label text ToUpper?

I have a few labels on my vb.net form. When I load a record sometimes the text is all lowercase.
How can I make the text change to all Upper case or ProperCase when the text changes?

I tried the following but it doesn't seem to work...

    Private Sub lblFirstName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblFirstName.TextChanged
        lblFirstName.Text.ToUpper()
        lblLastName.Text.ToUpper()
        lblStreetName.Text.ToUpper()
        lblCity.Text.ToUpper()
        lblState.Text.ToUpper()
    End Sub

LVL 1
Matrix1000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iboutchkineCommented:
dim s as string = "iouri"
lblFirstName.Text = s.ToUpper()
0
DotNetLover_BaanCommented:
HI there,
do not use the TextChanged event to do that. That is definitely gonna take more resource. Rather what you can do is, just before you display the data in the labels , change the case.

lblFirstName.Text = UCase(YourDataString)

-Baan
0
iboutchkineCommented:
Is not it the same that I wrote?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

DotNetLover_BaanCommented:
it is.. but I replied 1 min later.. unfortunately... lol
0
DotNetLover_BaanCommented:
If you want to keep what u are doing... do this

    Private Sub lblFirstName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblFirstName.TextChanged
        lblFirstName.Text=lblFirstName.Text.ToUpper()
        lblLastName.Text=lblLastName.Text.ToUpper()
        lblStreetName.Text=lblStreetName.Text.ToUpper()
        lblCity.Text=lblCity.Text.ToUpper()
        lblState.Text=lblState.Text.ToUpper()
    End Sub

-Baan
0
Matrix1000Author Commented:
-Baan

This is my database query... how would I add that....what would be "YourDataString" ?

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        ' Get data from selected row in ListBox
        ' Because I don't know which row of the original DataView this is
        ' it is probably easier to do a refined search which (hopefully) will only
        ' throw up one possible row

        ' First make sure the DataView will search the address column
        dvSocSecNo.Sort = "SocSecNo"
        ' Create a DataRowView and make it find the datarow that contains the address
        Dim ChosenRow() As DataRowView = dvSocSecNo.FindRows(Trim(ListBox1.SelectedItem))
        If ChosenRow.Length > 0 Then ' if a match found (and it should be!)
            Dim DRV As DataRowView
            ' Display data from other columns in textboxes
            For Each DRV In ChosenRow
                Me.txtSearch.Text = DRV("SocSecNo").ToString
                Me.lblFirstName.Text = DRV("FirstName").ToString
                Me.lblLastName.Text = DRV("LastName").ToString
                'Me.lblStreetNumber.Text = DRV("StreetNumber").ToString
                Me.lblStreetName.Text = DRV("Address1").ToString
                Me.lblCity.Text = DRV("City").ToString
                Me.lblState.Text = DRV("State").ToString
                Me.lblZip.Text = DRV("Zip").ToString

            Next
        Else
            MessageBox.Show("Data not found")
        End If
End Sub
0
DotNetLover_BaanCommented:
Change this part...

            For Each DRV In ChosenRow
                Me.txtSearch.Text = DRV("SocSecNo").ToString
                Me.lblFirstName.Text = UCase(DRV("FirstName").ToString)   'Add UCase() to all of them
                Me.lblLastName.Text = UCase(DRV("LastName").ToString)
                'Me.lblStreetNumber.Text = UCase(DRV("StreetNumber").ToString)
                Me.lblStreetName.Text = UCase(DRV("Address1").ToString)
                Me.lblCity.Text = UCase(DRV("City").ToString)
                Me.lblState.Text = UCase(DRV("State").ToString)
                Me.lblZip.Text = DRV("Zip").ToString

            Next
-Baan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.