TemplateControl.GetLocalResourceObject メソッド (String)
アセンブリ: System.Web (system.web.dll 内)

Dim resourceKey As String Dim returnValue As Object returnValue = Me.GetLocalResourceObject(resourceKey)
- resourceKey
ResourceKey を表す文字列。
要求されたリソース オブジェクトを表すオブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。


GetLocalResourceObject メソッドを使用して、App_LocalResources フォルダ内のローカル ページ リソースから LocalResourceString1 という名前の文字列にアクセスする方法を次のコード例に示します。
<%@ Page Language="VB" Culture="auto" UICulture="auto" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim localresourcestring As String Dim globalresourcestring As String ' Get the local resource string. Try localresourcestring = "Found the local resource string and it's value is: " & _ Convert.ToString(GetLocalResourceObject("LocalResourceString1")) & "." Catch localresourcestring = "Could not find local resource." End Try ' Get the global resource string. Try ' Look in the global resource file called MyResource.resx. globalresourcestring = "Found the global resource string and it's value is: " & _ Convert.ToString(GetGlobalResourceObject("MyResource", "GlobalResourceString1")) & "." Catch globalresourcestring = "Could not find global resource." End Try LocalResourceMessage.InnerText = localresourcestring GlobalResourceMessage.InnerText = globalresourcestring End Sub </script> <html > <head id="Head1" runat="server"> <title>TemplateControl GetGlobalResourceObject and GetLocalResourceObject Example</title> </head> <body> <form id="form1" runat="server"> <div> <h3>TemplateControl GetGlobalResourceObject and GetLocalResourceObject Example</h3> <span id="LocalResourceMessage" runat="server"/> <br /> <span id="GlobalResourceMessage" runat="server" /> </div> </form> </body> </html>
<%@ Page Language="C#" Culture="auto" UICulture="auto" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { string localresourcestring; string globalresourcestring; // Get the local resource string. try { localresourcestring = "Found the local resource string and it's value is: " + (String)GetLocalResourceObject("LocalResourceString1") + "."; } catch { localresourcestring = "Could not find local resource."; } // Get the global resource string. try { // Look in the global resource file called MyResource.resx. globalresourcestring = "Found the global resource string and it's value is: " + (String)GetGlobalResourceObject("MyResource", "GlobalResourceString1") + "."; } catch { globalresourcestring = "Could not find global resource."; } LocalResourceMessage.InnerText = localresourcestring; GlobalResourceMessage.InnerText = globalresourcestring; } </script> <html > <head runat="server"> <title>TemplateControl GetGlobalResourceObject and GetLocalResourceObject Example</title> </head> <body> <form id="form1" runat="server"> <div> <h3>TemplateControl GetGlobalResourceObject and GetLocalResourceObject Example</h3> <span id="LocalResourceMessage" runat="server"/> <br /> <span id="GlobalResourceMessage" runat="server" /> </div> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TemplateControl.GetLocalResourceObject メソッド (String, Type, String)
アセンブリ: System.Web (system.web.dll 内)

Protected Function GetLocalResourceObject ( _ resourceKey As String, _ objType As Type, _ propName As String _ ) As Object
Dim resourceKey As String Dim objType As Type Dim propName As String Dim returnValue As Object returnValue = Me.GetLocalResourceObject(resourceKey, objType, propName)
protected function GetLocalResourceObject ( resourceKey : String, objType : Type, propName : String ) : Object
- resourceKey
ResourceKey を表す文字列。
要求されたリソース オブジェクトを表すオブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TemplateControl.GetLocalResourceObject メソッド
- TemplateControl.GetLocalResourceObjectのページへのリンク