private void MatTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                var id = MatTree.SelectedNode.Name;
                var dt = _sqlDll.MaterialsTable();

                PropertyBox.Visible = false;
                label2.Visible      = true;

                MaterialName.Text = "";
                KodERP.Text       = "";
                Plotnost.Text     = "";
                SwProp.Text       = "";
                Description.Text  = "";
                KodMateriala.Text = "";

                foreach (DataRow LevelID in dt.Rows)
                {
                    if (LevelID["LevelID"].ToString() == id)
                    {
                        MaterialName.Text = LevelID["MaterialsName"].ToString();

                        if (MaterialName.Text == LevelID["MaterialsName"].ToString())
                        {
                            PropertyBox.Visible = true;
                            //PropertyTab.Enabled = true;
                            label2.Visible = false;

                            KodERP.Text   = LevelID["ERP"].ToString();
                            Plotnost.Text = LevelID["Density"].ToString();
                            SwProp.Text   = LevelID["SwProperty"].ToString();

                            //var matnamecncgetvalue = dt.Rows[0][MatNameCNC].ToString(); LevelID["MaterialsName"].ToString()
                            //Number = matnamecncgetvalue;

                            Description.Text  = LevelID["Description"].ToString();
                            KodMateriala.Text = LevelID["CodeMaterial"].ToString();

                            //TxtObrazec.Text = dt.Rows[0][hatch].ToString();
                            //TxtBoxAngel.Text = dt.Rows[0][angle].ToString();
                            //TxtDens.Text = dt.Rows[0][scale].ToString();
                            //TxtPwShader.Text = dt.Rows[0][pwshader].ToString();
                            //TxtPath.Text = dt.Rows[0][path].ToString();
                            //TxtBoxColorCod.Text = dt.Rows[0][RGB].ToString();
                        }
                        else
                        {
                            PropertyBox.Visible = false;
                            label2.Visible      = true;

                            MaterialName.Text = "";
                            KodERP.Text       = "";
                            Plotnost.Text     = "";
                            SwProp.Text       = "";
                            Description.Text  = "";
                            KodMateriala.Text = "";

                            //TxtObrazec.Text = "";
                            //TxtBoxAngel.Text = "";
                            //TxtDens.Text = "";
                            //TxtPwShader.Text = "";
                            //TxtPath.Text = "";
                            //TxtBoxColorCod.Text = "";
                            //MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }