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 6132009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:02:53+00:00 2026-05-23T17:02:53+00:00

I am learning the C# programming language and am making a payroll application add-on

  • 0

I am learning the C# programming language and am making a payroll application add-on for SAP business One. I have a TreeView and need to have the name of a node appear on a TextBox after a use clicks on that node or when he presses a button “Add”, preferably on click only. I am using Visual Studio 2010 and Microsoft SQL Server 2008.

Scenario:

- Component                        - Parent
          Earnings                     - child
              Housing Allowance                  - content of child
              Mobile Phone Allowance             - clicked and highlighted node
              Mileage Allowance
          Deductions                   - child

In the above, I would like a way such that if a user clicks on “Mobile Phone Allowance”, and it is highlighted, ‘Mobile Phone Allowance’ appears on a textbox. Im not sure if this can be done without having an Add button.

The Earnings and Deduction children are populated from a database. I need the above to make a Payroll calculator.

My Code:

private void PayrollFormulaBuilder_Load(object sender, EventArgs e)
{
    // Get service instance
    var earnDeductMasterService = Program.Kernel.Get<IEarnDeductMasterService>();

    //Query database for all records that have earnings
    var earnings = from ed in earnDeductMasterService.GetAllEarnDeductMasters()
                   where ed.U_PD_type.Trim().Equals("Earnings".Trim(), StringComparison.CurrentCultureIgnoreCase)
                   select ed.U_PD_description;

    if (earnings.Any(x => x != null))
    {
        //To populate subtree Earnings with U_PD_description  = Earnings results
        List<string> earningList = new List<string>(earnings) { };

        //adding all earnings to "Earnings" node
        foreach (string earning in earningList)
        {
            treeView1.Nodes[0].Nodes[0].Nodes.Add(earning);
        }
    }
    else
    {
        //Nothing to populate            
    }

    //Query database for all records that have deductions
    var deductions = from ed in earnDeductMasterService.GetAllEarnDeductMasters()
                     where ed.U_PD_type.Trim().Equals("Deductions".Trim(), StringComparison.CurrentCultureIgnoreCase)
                     select ed.U_PD_description;

    if (deductions.Any(x => x != null))
    {
        //To populate subtree Deductions with U_PD_description = Deductions results
        List<string> deductionList = new List<string>(deductions) { };

        //adding all earnings to "Earnings" node
        foreach (string deduction in deductionList)
        {
            treeView1.Nodes[0].Nodes[1].Nodes.Add(deduction);
        }
    }
    else
    {
        //Nothing to populate            
    }
}

I would imagine I would have to setup a method to capture this…but I’m not sure

private void treeView1_DoubleClick(object sender, EventArgs e)
{
    if (inputStatus)
    {
        formula_display.Text += "something here"  // my Richtextbox for showing input
    }
    else
    {
        formula_display.Text = "something here"
        inputStatus = true;
    }
}
  • 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-05-23T17:02:54+00:00Added an answer on May 23, 2026 at 5:02 pm

    Could you use the TreeView AfterSelect event in place of your “something here” ?

    treeview1.AfterSelect += new TreeViewEventHandler(treeview1_AfterSelect);
    

    ..and..

    void treeview1_AfterSelect(object sender, TreeViewEventArgs e)
    {
        formula_display.Text = e.Node.Text;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning the C# programming language and am making a payroll application add-on
I am learning the C# programming language and am making a payroll application add-on
I'm currently learning the fascinating J programming language, but one thing I have not
I am learning the C# programming language and am making a Payroll program addon
Hello everyone I am just learning my first programming language and have just corrected
Do you recommend learning C++ using a template? Edit I have basic programming language
I'm learning Python as my second programming language (my first real one if you
Duplicate of: Learning to write a compiler Documentation on creating a programming language Learning
I started learning JavaScript a while ago. It's a fairly easy programming language considering
OS: Linux, Language: pure C I'm moving forward in learning C programming in general,

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.