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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:58:31+00:00 2026-06-07T20:58:31+00:00

I am trying to create a table with check marks and WPF controls (a

  • 0

I am trying to create a table with check marks and WPF controls (a range slider with two textblocks). WPF controls is written using Avalon library and I successfully added that to my table. But, when the form is closed, I need to get the texts from textblocks and apply that somewhere.
I can iterate through the controls on the form, and find element host, but I don’t know how to extract the value from two text blocks on the form. My code is attached below. Can you please help me with this?

Code:

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public static TableLayoutPanel _T;
        static void set_globalvalue(TableLayoutPanel val)
        {
            _T = val;
        }

        public Form1()
        {
            InitializeComponent();

            TableLayoutPanel TP = new TableLayoutPanel();
            TP.ColumnCount = 2;
            TP.RowCount = 5;
            TP.BackColor = Color.White;
            this.Controls.Add(TP);
            TP.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
            int size = 0;
            for (int i = 0; i < TP.RowCount; i++)
            {
                ElementHost host = new ElementHost();
                UserControl1 uc = new UserControl1(1,15);
                host.Name = i.ToString();
                host.Dock = DockStyle.Top;
                host.Child = uc;
                TP.Controls.Add(host, 1, i);
                host.Width = 270;
                host.Height = 40;
                CheckBox ch = new CheckBox();
                ch.Name = i.ToString() + "_che";
                TP.Controls.Add(ch, 0, i);
                size = size + host.Height+20;
            }

            TP.Height = size;
            TP.Width = 700;
            set_globalvalue(TP);
            this.FormClosing += Form1_FormClosing;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            for (int i = 1; i <= _T.ColumnCount; i++)
            {
                for (int j = 0; j <= _T.RowCount; j++)
                {
                    Control c = _T.GetControlFromPosition(i, j);

                    if (c != null & c is System.Windows.Forms.Integration.ElementHost)
                    {
                        ElementHost host =c as ElementHost;
                        System.Windows.UIElement u = host.Child;
                          ???????????????????
                    }
                }
            }
        }
    }
} 
  • 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-07T20:58:33+00:00Added an answer on June 7, 2026 at 8:58 pm

    Once you have the reference to the element host, you can do something along these lines:

    ElementHost host = c as ElementHost;
    
    UserControl1 uc = host.Child as UserControl1;
    
    if (uc != null)
    {
       //Get the text from uc
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a check constraint on an access (jet?) table. So,
I am trying to create a table with a single column using the following
I'm using Oracle 11g, and trying to create a table define constraints on the
I am trying to create a table in Drupal database using hook_schema function but
I'm trying to create table from view from remote server (calling procedure UPDATE_PROC), like
I am trying to create this table in a MySQL database CREATE TABLE IF
Hi this is the table I am trying to create: CREATE TABLE images (
I am trying to create a table for printing purpose. As seen in many
I am trying to create a table layout filled with lots of bits of
I am trying to create a table with values that are in a String

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.