Announcement

Collapse
No announcement yet.

txt file in Combobox

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • txt file in Combobox

    Hi,

    ich habe eine Form mit einer Combobox und einem Button.
    Mit dem Button öffne ich den explorer und kann ein txtfile auswählen.

    Code:
    private void btnDurchsuchenKabelfaktoren_Click(object sender, EventArgs e)
            {
                Stream myStream = null;
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
    
                openFileDialog1.InitialDirectory = "c:\\";
                openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;
    
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        if ((myStream = openFileDialog1.OpenFile()) != null)
                        {
                            using (myStream)
                            {
                               ??????????????????????
                               !!!hier sollte doch dann der code her!!
    
                            }
                        }
                    }
                    
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                    }
                }
            }
    Hier nun meine eigt. Frage:
    Wie kann ich nun den Ihnhalt des txtfiles der combobox übergeben, dass ich danach einen der gewünschten werte aus dem txtfile auswählen kann...

    LG und danke schon mal jkRf4n

  • #2
    Antwort siehe im Doppel-Post. Jürgen

    Comment

    Working...
    X