Skip to content

StrConv("text",VbStrConv.ProperCase) causes a confusing error error #95451

Open

Description

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
I converted my app from .net framework to .NET 6 which resulted in thousands of errors.
I deleted all references to menus that elimated several problems. I'm working a workaround for them as I was phasing them out anyway.
I found a solution to 1 set and a workaround for another.
This one has me puzzled since I changed all my code that was using Chr() and Asc() that was previously causing an 'encoding 1252' error
to ChrW() and AscW() that doesn't cause an error on any of my lines of code.

The code that triggers the error now is

    For Each name As String In Data_Text_string_array
        If name.Length > 1 Then
            Try
                ListBox_Data.Items.Add(StrConv(Function_Name_Full_string(name), VbStrConv.ProperCase))  <-- triggers the error
            Catch
                MsgBox(Err.Description)
                ListBox_Data.Items.Add(Function_Name_Full_string(name))
            End Try
            count += 1
            Names_Writers_string_array(count) = name
        End If
    Next

The MsgBox doesn't even appear, so my code can't catch it.
I can't use similar coding for now.

Changing the code as follows works, so I'll have to create a Function to replace it.

    For Each name As String In Data_Text_string_array
        If name.Length > 1 Then
                ListBox_Data.Items.Add(Function_Name_Full_string(name))
            count += 1
            Names_Writers_string_array(count) = name
        End If
    Next

Original Comments

Feedback Bot on 11/20/2023, 03:00 AM:

(private comment, text removed)

John Qiao [MSFT] on 11/20/2023, 03:24 AM:

(private comment, text removed)

Tom Loewen on 11/20/2023, 05:38 AM:

(private comment, text removed)

Feedback Bot on 11/20/2023, 08:17 AM:

(private comment, text removed)


Original Solutions

(no solutions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions