PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Exception trying to retrieve from My.Resources

Reply

Exception trying to retrieve from My.Resources

 
Thread Tools Rate Thread
Old 13-02-2007, 05:44 PM   #1
=?Utf-8?B?QmFycnkgR2lsYmVydA==?=
Guest
 
Posts: n/a
Default Exception trying to retrieve from My.Resources


In a Property Set statement, I'm trying to retrieve a value from My.Resources
like this:

Public Property TimeEnd() As DateTime

<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Get
Return _timeEnd.Date
End Get

<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Set(ByVal value As DateTime)
CanWriteProperty(True)
If Not _timeEnd.Equals(value) Then
_timeEnd.Date = DateAdd(DateInterval.Year,
CInt(My.Resources.SqlMinYear), value.TimeOfDay)
End If
End Set

The purpose of SqlMinYear is to allow the UI to receive a time only and to
store it by appending SQL Server's min date. However, when I try to retrieve
this Resources string, I get this error:

"'My.Resources.SqlMinYear' is not declared or the module containing it is
not loaded in the debugging session."

I get the same thing if I try to get the value in the immediate window.

Any ideas?
  Reply With Quote
Old 13-02-2007, 05:49 PM   #2
=?Utf-8?B?QmFycnkgR2lsYmVydA==?=
Guest
 
Posts: n/a
Default RE: Exception trying to retrieve from My.Resources

Never mind. It turns out that if I use Console.WriteLine, it does correctly
display the value. I don't understand why, but statements in the immediate
window don't always jive with what is returned by Console.Write.

Also, sorry for the triple post; it's some bug in my Firefox installation.

Barry

"Barry Gilbert" wrote:

> In a Property Set statement, I'm trying to retrieve a value from My.Resources
> like this:
>
> Public Property TimeEnd() As DateTime
>
> <System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
> Get
> Return _timeEnd.Date
> End Get
>
> <System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
> Set(ByVal value As DateTime)
> CanWriteProperty(True)
> If Not _timeEnd.Equals(value) Then
> _timeEnd.Date = DateAdd(DateInterval.Year,
> CInt(My.Resources.SqlMinYear), value.TimeOfDay)
> End If
> End Set
>
> The purpose of SqlMinYear is to allow the UI to receive a time only and to
> store it by appending SQL Server's min date. However, when I try to retrieve
> this Resources string, I get this error:
>
> "'My.Resources.SqlMinYear' is not declared or the module containing it is
> not loaded in the debugging session."
>
> I get the same thing if I try to get the value in the immediate window.
>
> Any ideas?

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off