"string resource file" in c#?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan H.

    #1

    "string resource file" in c#?

    Hello,
    What is the equivalent "string resource file" in c#?

    And, is there a way to create a beep in C#?

    Thanks,
    Dan


  • 100

    #2
    Re: "string resource file" in c#?

    Hi Dan,[color=blue]
    > What is the equivalent "string resource file" in c#?[/color]

    I don't think there is equivalent of string resource since you can embed
    whatever stream you want into a assembly. My suggestion is to use XML file
    for keeping the strings. If you need language specific versions of the
    strings you can use satellite assemblies, which will contain different
    versions of that xml file.
    [color=blue]
    > And, is there a way to create a beep in C#?[/color]
    There is no class in the current vesrion of the framework providing this.
    You have to use P\Invike to call MessageBeep or whatever other API function
    you want. If search the net I believe there are tons of examples how to do
    beeps.

    HTH
    B\rgds
    100


    Comment

    • Tom Clement

      #3
      Re: "string resource file" in c#?

      Hi Dan,

      If your purpose is internationaliz ation and localization, with .NET,
      Microsoft (finally) provides truely excellent support. (Even if you want a
      string resource for some other reason, these features will do the trick for
      you.) Take a look at the Localizable property on the Form properties
      window. Turn it on and all form and control properties will be stored in a
      separate resources file. Take a look at the InitializeCompo nent() code to
      see how it works. In addition, Microsoft provides a WinRes.exe resource
      editor that lets localizers edit these properties without having access to
      the code. Since the resource is an XML file (e.g. Form1.resx file) you can
      use any XML editor to modify its contents if you'd like.

      In addition, .NET supports the creation of multiple resource files using a
      hierarchical model. There is a basic invarient resource, then ones that are
      language specific, then ones that are dialect specific and so forth. All of
      this is supported in the default Form, so you can explore these features in
      the Form properties. For example, try setting the Language to French and
      see what happens.

      Tom Clement
      Apptero, Inc.

      "Dan H." <DapperDanH@NO. comcast.SsPpAaM m.net> wrote in message
      news:uUyxPXUpDH A.2528@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Hello,
      > What is the equivalent "string resource file" in c#?
      >
      > And, is there a way to create a beep in C#?
      >
      > Thanks,
      > Dan
      >
      >[/color]


      Comment

      • Mihai N.

        #4
        Re: &quot;string resource file&quot; in c#?

        > What is the equivalent "string resource file" in c#?
        Yes.
        The .NET string resource file looks like the Java properties
        (id=string), but the encoding uses UTF8 instead of Java escape.

        The extension is .txt (I think a bad idea), and can be compiled
        with ResGen to a .resources file
        You can also use .resx files (xml format)
        ResGen is able to convert between .resx, .txt and .resources
        (but if the resx contain forms, images, etc, it will drop them)

        Mihai

        Comment

        • Terence Lee

          #5
          Re: &quot;string resource file&quot; in c#?


          "Dan H." <DapperDanH@NO. comcast.SsPpAaM m.net> ¦b¶l¥ó
          news:uUyxPXUpDH A.2528@TK2MSFTN GP10.phx.gbl ¤¤¼¶¼g...[color=blue]
          > Hello,
          > What is the equivalent "string resource file" in c#?
          >[/color]

          If the purpose is for Localization, simply set your form's Localizable
          property to true and then change the Language property to whatever language
          you want and start changing the control's text. The locailization
          information will be stored in the language specific resx files.
          [color=blue]
          > And, is there a way to create a beep in C#?
          >[/color]

          Include the following in your class file to 'Beep'

          [System.Runtime. InteropServices .DllImport("use r32.dll")]
          public static extern int MessageBeep(uin t n);
          [color=blue]
          > Thanks,
          > Dan
          >
          >[/color]


          Comment

          • Joe

            #6
            Re: &quot;string resource file&quot; in c#?

            Is any of this possible (reasonably easily :-)) without VS.Net? I am
            using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
            something working similar to what is in VS.Net. Ya, I know, just buy
            VS.Net :-) But I am cheap.

            It seems like what I need is basically a resource editor that
            generates .resx files (including stuff like size of Dialog boxes,
            etc), but am still naive about how all this resource stuff works.

            Any one have any experience with this?

            Thanks,

            Joe

            "Terence Lee" <tcflee@netviga tor.com> wrote in message news:<efIEGAopD HA.488@tk2msftn gp13.phx.gbl>.. .[color=blue]
            > "Dan H." <DapperDanH@NO. comcast.SsPpAaM m.net> ¦b¶l¥ó
            > news:uUyxPXUpDH A.2528@TK2MSFTN GP10.phx.gbl ¤¤¼¶¼g...[color=green]
            > > Hello,
            > > What is the equivalent "string resource file" in c#?
            > >[/color]
            >
            > If the purpose is for Localization, simply set your form's Localizable
            > property to true and then change the Language property to whatever language
            > you want and start changing the control's text. The locailization
            > information will be stored in the language specific resx files.
            >[/color]

            Comment

            • Joe

              #7
              Re: &quot;string resource file&quot; in c#?

              Is any of this possible (reasonably easily :-)) without VS.Net? I am
              using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
              something working similar to what is in VS.Net. Ya, I know, just buy
              VS.Net :-) But I am cheap.

              It seems like what I need is basically a resource editor that
              generates .resx files (including stuff like size of Dialog boxes,
              etc), but am still naive about how all this resource stuff works.

              Any one have any experience with this?

              Thanks,

              Joe

              "Terence Lee" <tcflee@netviga tor.com> wrote in message news:<efIEGAopD HA.488@tk2msftn gp13.phx.gbl>.. .[color=blue]
              > "Dan H." <DapperDanH@NO. comcast.SsPpAaM m.net> ¦b¶l¥ó
              > news:uUyxPXUpDH A.2528@TK2MSFTN GP10.phx.gbl ¤¤¼¶¼g...[color=green]
              > > Hello,
              > > What is the equivalent "string resource file" in c#?
              > >[/color]
              >
              > If the purpose is for Localization, simply set your form's Localizable
              > property to true and then change the Language property to whatever language
              > you want and start changing the control's text. The locailization
              > information will be stored in the language specific resx files.
              >[/color]

              Comment

              • Mountain Bikn' Guy

                #8
                Re: &quot;string resource file&quot; in c#?

                SharpDevelop makes the full framework available to you.

                To generate .resx files, use code something like this:

                ResXResourceWri ter rw = new
                ResXResourceWri ter(@"C:\myFull PathAndFileName + ".resx");
                rw.AddResource( "Key", value);
                //add more key/value pairs, etc.
                rw.Generate();
                rw.Close();

                you need a using statement like:
                using System.Resource s;

                and you need to ref the WinForms DLL


                "Joe" <jwdaigle@hotma il.com> wrote in message
                news:6f6c12f8.0 312032117.68bcf 71b@posting.goo gle.com...[color=blue]
                > Is any of this possible (reasonably easily :-)) without VS.Net? I am
                > using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
                > something working similar to what is in VS.Net. Ya, I know, just buy
                > VS.Net :-) But I am cheap.
                >
                > It seems like what I need is basically a resource editor that
                > generates .resx files (including stuff like size of Dialog boxes,
                > etc), but am still naive about how all this resource stuff works.
                >
                > Any one have any experience with this?
                >
                > Thanks,
                >
                > Joe
                >
                > "Terence Lee" <tcflee@netviga tor.com> wrote in message[/color]
                news:<efIEGAopD HA.488@tk2msftn gp13.phx.gbl>.. .[color=blue][color=green]
                > > "Dan H." <DapperDanH@NO. comcast.SsPpAaM m.net> ¦b¶l¥ó
                > > news:uUyxPXUpDH A.2528@TK2MSFTN GP10.phx.gbl ¤¤¼¶¼g...[color=darkred]
                > > > Hello,
                > > > What is the equivalent "string resource file" in c#?
                > > >[/color]
                > >
                > > If the purpose is for Localization, simply set your form's Localizable
                > > property to true and then change the Language property to whatever[/color][/color]
                language[color=blue][color=green]
                > > you want and start changing the control's text. The locailization
                > > information will be stored in the language specific resx files.
                > >[/color][/color]


                Comment

                Working...