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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:33:24+00:00 2026-05-25T00:33:24+00:00

In my C# Windows Form Application, I have Treeview control with checkboxes. I want

  • 0

In my C# Windows Form Application, I have Treeview control with checkboxes.

I want to hide check box of the certain tree node in TreeView control from user.How i do it?.

Please Guide me to get out of this issue…

  • 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-25T00:33:25+00:00Added an answer on May 25, 2026 at 12:33 am

    This article explains on how you can hide the checbox of a certain node in a treeview.

    Update

    Explanation and code from the article:

    Currently, there is not build-in support to get this done. But we can send
    a TVM_SETITEM message to the treeview control, set TVITEM structure’s state
    field to 0, and TVITEM’s hItem field to the treenode’s handle. Then this
    treenode will be got rid of the checkbox.

    Sample code lists below:

    public const int TVIF_STATE = 0x8;
    public const int TVIS_STATEIMAGEMASK = 0xF000;
    public const int TV_FIRST= 0x1100;
    public const int  TVM_SETITEM = TV_FIRST + 63;
    
    public struct TVITEM
    {
        public int mask;
        public IntPtr hItem;
        public int state;
        public int stateMask;
        [MarshalAs(UnmanagedType.LPTStr)]
        public String lpszText;
        public int cchTextMax;
        public int iImage;
        public int iSelectedImage;
        public int cChildren;
        public IntPtr lParam;
    }
    
    [DllImport("user32.dll")]
    static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    
    private void button1_Click(object sender, System.EventArgs e)
    {
        TVITEM tvi=new TVITEM();
        tvi.hItem=this.treeView1.SelectedNode.Handle;
        tvi.mask=TVIF_STATE;
        tvi.stateMask = TVIS_STATEIMAGEMASK;
        tvi.state=0;
        IntPtr lparam=Marshal.AllocHGlobal(Marshal.SizeOf(tvi));
        Marshal.StructureToPtr(tvi, lparam, false);
        SendMessage(this.treeView1.Handle, TVM_SETITEM, IntPtr.Zero, lparam);
    }
    

    This code hides the selected treenode’s checkbox and it works well on my
    side. You may copy and paste in your project to have a test.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Form Application in which clicking certain buttons create objects from
net windows form application. I have a combo box and a text box and
I have a form in a Windows form application that I want to display
I have this application (Windows form application written in Visual C++) from a colleague
I have a windows form application which has a text box and 3 buttons.
I have windows form application written in VC ++ . I want to change
I have C# windows form application that queries data from a connected device. I
I have a windows form application that uses a Shared class to house all
I have a Windows Form application built on a data model and a Windows
I have a C# Windows Form application that contains a menu with this event:

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.