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

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


GetGlobalResourceObject メソッドを使用して、App_GlobalResources フォルダ内の MyResource.resx という名前のグローバル リソースから GlobalResourceString1 という名前の文字列にアクセスする方法を次のコード例に示します。className パラメータが .resx 拡張子なしの MyResource になります。
<%@ 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.GetGlobalResourceObject メソッド (String, String, Type, String)
アセンブリ: System.Web (system.web.dll 内)

Protected Function GetGlobalResourceObject ( _ className As String, _ resourceKey As String, _ objType As Type, _ propName As String _ ) As Object
Dim className As String Dim resourceKey As String Dim objType As Type Dim propName As String Dim returnValue As Object returnValue = Me.GetGlobalResourceObject(className, resourceKey, objType, propName)
protected Object GetGlobalResourceObject ( string className, string resourceKey, Type objType, string propName )
protected: Object^ GetGlobalResourceObject ( String^ className, String^ resourceKey, Type^ objType, String^ propName )
protected Object GetGlobalResourceObject ( String className, String resourceKey, Type objType, String propName )
protected function GetGlobalResourceObject ( className : String, resourceKey : String, objType : Type, propName : String ) : Object
- className
ClassKey を表す文字列。
- 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.GetGlobalResourceObject メソッド

名前 | 説明 |
---|---|
TemplateControl.GetGlobalResourceObject (String, String) | アプリケーション レベル リソース オブジェクトを、指定した ClassKey プロパティおよび ResourceKey プロパティに基づいて取得します。 |
TemplateControl.GetGlobalResourceObject (String, String, Type, String) | アプリケーション レベル リソース オブジェクトを、指定されたリソースの ClassKey プロパティ、ResourceKey プロパティ、オブジェクト型、およびプロパティ名に基づいて取得します。 |

- TemplateControl.GetGlobalResourceObjectのページへのリンク