Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:59:51+00:00 2026-06-08T09:59:51+00:00

I have class ! class Reg_v_no_string { public static string key_place = ; public

  • 0

I have class !

class Reg_v_no_string
{
    public static string key_place = "";
    public static string key = "";
    public static string value = "";
    public string reg_value(string key_place, string key)
    {
        string value = string.Empty;

            RegistryKey klase = Registry.CurrentUser;
            klase = klase.OpenSubKey(key_place);
            value = klase.GetValue(key).ToString();
            klase.Close();

        return value;
    }
}

and this returns blank message box.
How can solve this problem !?
Thanks !

how can i return value from this class ?

I tryed

private void kryptonButton1_Click(object sender, EventArgs e)
    {
        Reg_v_no_string.key_place = @"Control Panel\Desktop";
        Reg_v_no_string.key_place = "WheelScrollLines";
        MessageBox.Show(Reg_v_no_string.value);

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:59:54+00:00Added an answer on June 8, 2026 at 9:59 am

    You need to actually call the method:

    private void kryptonButton1_Click(object sender, EventArgs e) 
    { 
        var value = reg_value(@"Control Panel\Desktop", "WheelScrollLines");
        MessageBox.Show(value); 
    } 
    

    Also consider some changes to your class:

    public static class Reg_v_no_string 
    { 
        public static string reg_value(string key_place, string key) 
        { 
            string value = string.Empty; 
    
             RegistryKey klase = Registry.CurrentUser; 
             // todo: add some error checking to make sure the key is opened, etc.
             klase = klase.OpenSubKey(key_place); 
             value = klase.GetValue(key).ToString(); 
             klase.Close(); 
    
            return value; 
        } 
    } 
    

    And then when you call this static class it is like this:

    // you don't need to `new` this class if it is static:
    var value = Reg_v_no_string.reg_value(@"Control Panel\Desktop", "WheelScrollLines");
    

    Or, to keep it so that it is not static:

    public class Reg_v_no_string 
    { 
        public string reg_value(string key_place, string key) 
        { 
            string value = string.Empty; 
    
             RegistryKey klase = Registry.CurrentUser; 
             // todo: add some error checking to make sure the key is opened, etc.
             klase = klase.OpenSubKey(key_place); 
             value = klase.GetValue(key).ToString(); 
             klase.Close(); 
    
            return value; 
        } 
    } 
    

    Then call it like this:

    Reg_v_no_string obj = new Reg_v_no_string ();
    var value = reg_value(@"Control Panel\Desktop", "WheelScrollLines");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class with back reference: public class Employee : Entity { private string
I have declared: class aaa { public: static std::queue<QPair<void (*)( ... ), int> >
I have a view model public class PersonsViewmodel { public string FirstName { get;
I have class with collection as below public class MyClass:IXmlSerializable { int vesrion; private
I have class that looks like this: class A { public: class variables_map vm
i have this xpath defined for moxy in a jaxb class @XmlPath(child::*/REG) public List
I have 1 registry entry of type REG_MULTI_SZ. This entry already contains some string
I have Class and Student objects. Both have collection of another as property. Which
I have class LegacyClass which inherits OldBaseClass. I'm considering a change to introduce a
I have class that extend FragmentActivity in it I add fragment to layout as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.