Enumerable of String ver 2 (VB , enum , .net)

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.

In an earlier post about making an enumerable of strings I proposed a method to have string enumerated for better intellisense. I suggest you read that post for the background. I have discovered another way to do something similar. This code also provides the great intellisence of an enumerable but does not use and enumerable. It only works in VB. The big change is a post I found on Stack overflow about the Hidden Features of VB.Net. It is the completionlist tag. Note this tag below. Here is good example is a post by Dustin Campbell – Lesser-Known VB: Customizing the Completion List showing how it is done. In my implementation I also needed a way to find out is a string was in the enumerated items. For that I had to do reflection (WARNING speed reduction). Unlike the previous example this uses full on reflection. I still am not sure if tags are as detrimental as regular reflection. Be sure to do performance testing on this example before using it.

Here is the Completion list XML decorating a new class that will hold the strings.

''' <completionlist cref="InventoryStatusCodes"/>
Public Class InevntoryStatusCode
    Private ReadOnly _Text As String
    Public Sub New(ByVal Text As String)
        _Text = Text
    End Sub
    Public ReadOnly Property GetScreenText() As String
        Get
            Return _Text
        End Get
    End Property
End Class

Here is how we apply the string to the names that will display like when you use an enumerable

Public NotInheritable Class InventoryStatusCodes
    Public Shared ReadOnly Open As New InevntoryStatusCode("O")
    Public Shared ReadOnly Closed As New InevntoryStatusCode("C")
    Public Shared ReadOnly OnRequest As New InevntoryStatusCode("R")
End Class

Here is the function I use when I have some screen text and I want to return the proper enumerated value. If it is supplied a “O” it would return and Open Inventory Status code object.

Public Function ScreenTextToStatusInventoryCode(ByVal ScreenText As String) As InevntoryStatusCode
        Dim i As New InventoryStatusCodes
        Dim t As Type = i.GetType
        Dim f() As FieldInfo = t.GetFields

        Dim isc As InevntoryStatusCode '= InventoryStatusCodes.Open

        For Each Field In f
            isc = Field.GetValue(Field)
            If ScreenText = isc.GetScreenText Then Return isc
        Next

        Return Nothing
    End Function

Here is an example of it being used

'We read in an O string text from the old mainfram screen.
Dim IncomingStringText As String = "O"
If IncomingStringText = InventoryStatusCodes.OnRequest.GetScreenText Then
    'This if statement can be used to test if it was Open 
End If

'We can also store it in an object like
Dim Codes As New List(Of InevntoryStatusCode)

Codes.Add(ScreenTextToStatusInventoryCode(IncomingStringText))

Here is a screen shot of the intellisense in action

image

Let me know what you think but please be kind.