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'm currently learning Haskell, Which language (F# or Haskell) do you prefer for programming
I'm learning functional programming, and have tried to solve a couple problems in a
I'm interested in learning a programming language with support for GUI, multithreading and easy
I am looking in to learning a programming language (take a course) for use
As a web developer, is it worth me learning the programming language C? Will
I have read numerous time that learning a language such as Haskell, Lisp or
I'm learning Python (and it's my first programming language so don't be too intense
I'm learning iPhone programming from Erica Sadun's The iPhone Developer's Cookbook. When I run
As I continue my quest of learning functional programming, I've come to wonder if
I'm learning about Win32 programming, and the WinMain prototype looks like: int WINAPI WinMain

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.