Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Controls auf einem UserControl ansprechen

Empfohlene Antworten

Veröffentlicht

Programmiersprache: C#

Visual Studio 2005

Also ich habe eine neue Klasse geschrieben die von einem UserControl abgeleitet ist. Dies dient mir sozusagen als Panel.

Auf diesem UserControl befinden sich ComboBoxen,Textboxen und paar Radiobuttons.

Ich lasse nun jedesmal wenn ich aus der Comobox was ausgewählt habe lasse ich als eine neue Instanz dieses Panels auf einem Formularfenster ausgeben.

Das funzt auch alles wunderbar.

Nun steht für mich die Frage wie bekomme ich die eingegebenen Daten wieder raus.

Hier meine UserControl-Klasse die ich FilterPanel getauft habe:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Text;

using System.Windows.Forms;

using Infra_Setup_Generator.Properties;

using System.Data.Odbc;


namespace Infra_Setup_Generator

{

    public partial class FilterPanel : UserControl

    {

        public FilterPanel()

        {

            InitializeComponent();

        }


        private bool isNew;


        public bool IsNew

        {

            get { return isNew; }

            set { isNew = value; }

        }


        private string filterbedingung;


        public string Filterbedingung

        {

            get { return filterbedingung; }

            set { filterbedingung = value; }

        }


        private string verknuepfung;


        public string Verknuepfung

        {

            get { return verknuepfung; }

            set { verknuepfung = value; }

        }


        private FlowLayoutPanel parentPanel;


        public FlowLayoutPanel ParentPanel

        {

            get { return parentPanel; }

            set { parentPanel = value; }

        }

        private string[] aspalten;


        public string[] Aspalten

        {

            get { return aspalten; }

            set { aspalten = value; }

        }



        public FilterPanel(string[] spalten) :this()

        {

            aspalten = spalten;

            CboSpalte.Items.Add("[Auswählen]");


            for (int i = 0; i <= spalten.GetUpperBound(0); i++)

            {

                CboSpalte.Items.Add(spalten[i]);

            }

            IsNew = true;

            CboSpalte.SelectedIndex = 0;

            CboOp.SelectedIndex = 0;

            RbUnd.Checked = true;

        }


        private void CboSpalte_SelectedIndexChanged(object sender, EventArgs e)

        {

            Settings s = new Settings();

            if (CboSpalte.SelectedIndex == 0)

            {

                if (!IsNew)

                {

                    this.parentPanel.Controls.Remove(this);

                }

            }

            else

            {

                if(IsNew)

                {

                    IsNew = false;

                    CboOp.Show();

                    TxtFilter.Show();

                    RbUnd.Show();

                    RbOder.Show();


                    OdbcConnection con = new OdbcConnection(s.ConStringODBC);

                    String[] SSpalten;


                    SSpalten = new String[s.AnzSp];

                    SSpalten = s.Spalten.Split(';');

                    FilterPanel filtpan = new FilterPanel(aspalten);

                    filtpan.parentPanel = this.parentPanel;

                    this.parentPanel.Controls.Add(filtpan);

                }

            }

        }


        private void Eingabe_Validated(object sender, EventArgs e)

        {

            filterbedingung = CboSpalte.SelectedText + " " + CboOp.SelectedText + " '" + TxtFilter.Text + "'";

        }


        private void Radio_CheckedChanged(object sender, EventArgs e)

        {

            if (RbUnd.Checked)

            {

                verknuepfung = " AND ";

            }

            else

            {

                verknuepfung = " OR ";

            }

        }

    }

}

Vielen Dank für eure Hilfe schonmal ;)

Bearbeitet von O_Neill
Angaben zur Programmierumgebung vergessen.

Ok, ich glaub es hat sich erledigt. Irgendwie hatte ich mich festgefahren aber eben is mir nen "Geistesblitz" gekommen. *gg

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.