Click here to Skip to main content
16,019,273 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Insert timestamp using datareader to oracle date Pin
kerek227-Oct-20 16:32
kerek227-Oct-20 16:32 
GeneralRe: Insert timestamp using datareader to oracle date Pin
Dave Kreskowiak27-Oct-20 18:27
mveDave Kreskowiak27-Oct-20 18:27 
GeneralRe: Insert timestamp using datareader to oracle date Pin
kerek229-Oct-20 14:11
kerek229-Oct-20 14:11 
GeneralRe: Insert timestamp using datareader to oracle date Pin
Dave Kreskowiak29-Oct-20 14:13
mveDave Kreskowiak29-Oct-20 14:13 
GeneralRe: Insert timestamp using datareader to oracle date Pin
Victor Nijegorodov27-Oct-20 21:11
Victor Nijegorodov27-Oct-20 21:11 
GeneralRe: Insert timestamp using datareader to oracle date Pin
DerekT-P7-Oct-20 23:39
professionalDerekT-P7-Oct-20 23:39 
GeneralRe: Insert timestamp using datareader to oracle date Pin
kerek211-Oct-20 17:14
kerek211-Oct-20 17:14 
QuestionCreate an assignment operator that accepts as const value: CLOSED Pin
mo149230-Sep-20 5:36
mo149230-Sep-20 5:36 
Sorry, this always seems to happen after I post but I think I get it now. I'm trying to assign a value to a class. It compiles if i do this:
Private Sub ab(Optional ByVal val As EncryptKey = Nothing)
end Sub

I was confused by this:
Private Sub ab(Optional ByVal val As String = "")
end Sub

I don't know how String is defined to be able to accept this but what I'm doing won't work.
Sorry again for the ugly post.



Sorry about the subject line; didn't know how to describe my problem.
Through searching around the internet i've come up with this class to be able to process a string value.

Class EncryptKey
Private _string As String = String.Empty

Public Sub New(ByVal value As String)
' Remove white space
Me._string = value.Trim()
End Sub

Public Shared Widening Operator CType(ByVal value As String) As EncryptKey
Return New EncryptKey(value)
End Operator

Public Overrides Function ToString() As String
Return _string
End Function

Public Function Length() As Integer
Return Me._string.Length
End Function

Public Function IsEmpty() As Boolean
Return (_string.Length = 0)
End Function

Public Shared Operator +(ByVal s1 As EncryptKey, ByVal s2 As EncryptKey) As EncryptKey
' Concat and remove white space
Dim temp As String = (s1._string + s2._string).Trim()
Return New EncryptKey(temp)
End Operator

End Class

The class is working except for this case:

Private Sub ab(Optional ByVal val As EncryptKey = "")
' Results in this error for the Optional assigment:
'error BC30060: Conversion from 'String' to 'EncryptKey' cannot occur in a constant expression.
End Sub

Is there a way to make the class able to accept this assignment as an Optional parameter?
Thank you

-- modified 30-Sep-20 12:34pm.
Questionselect MIN(Date) value and other data from multiple table Pin
kerek228-Sep-20 22:46
kerek228-Sep-20 22:46 
SuggestionRe: select MIN(Date) value and other data from multiple table Pin
Richard Deeming29-Sep-20 0:10
mveRichard Deeming29-Sep-20 0:10 
GeneralRe: select MIN(Date) value and other data from multiple table Pin
kerek230-Sep-20 21:17
kerek230-Sep-20 21:17 
GeneralRe: select MIN(Date) value and other data from multiple table Pin
Richard Deeming30-Sep-20 22:03
mveRichard Deeming30-Sep-20 22:03 
AnswerRe: select MIN(Date) value and other data from multiple table Pin
DerekT-P29-Sep-20 7:37
professionalDerekT-P29-Sep-20 7:37 
AnswerRe: select MIN(Date) value and other data from multiple table Pin
Gerry Schmitz1-Oct-20 5:36
mveGerry Schmitz1-Oct-20 5:36 
QuestionChanging of date format problem upon retrieving in date field Pin
Member 1494895025-Sep-20 20:39
Member 1494895025-Sep-20 20:39 
AnswerRe: Changing of date format problem upon retrieving in date field Pin
Victor Nijegorodov25-Sep-20 21:11
Victor Nijegorodov25-Sep-20 21:11 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Member 1494895025-Sep-20 21:19
Member 1494895025-Sep-20 21:19 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Dave Kreskowiak26-Sep-20 5:49
mveDave Kreskowiak26-Sep-20 5:49 
AnswerRe: Changing of date format problem upon retrieving in date field Pin
Richard MacCutchan25-Sep-20 22:02
mveRichard MacCutchan25-Sep-20 22:02 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Member 1494895025-Sep-20 22:28
Member 1494895025-Sep-20 22:28 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Richard MacCutchan25-Sep-20 22:44
mveRichard MacCutchan25-Sep-20 22:44 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Member 1494895025-Sep-20 22:57
Member 1494895025-Sep-20 22:57 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Richard MacCutchan25-Sep-20 23:16
mveRichard MacCutchan25-Sep-20 23:16 
GeneralRe: Changing of date format problem upon retrieving in date field Pin
Dave Kreskowiak26-Sep-20 5:59
mveDave Kreskowiak26-Sep-20 5:59 
QuestionAccessing a known Outlook subfolder Pin
Member 1205805425-Sep-20 1:25
Member 1205805425-Sep-20 1:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.