Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF VB.NET : how to insert a notepad in listbox

$
0
0

I already used the code as below.

 Dim openfile1 = New Microsoft.Win32.OpenFileDialog With {.Filter = "Text (*.Text)|*.txt"}
        If (openfile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
            For Each line As String In File.ReadAllLines(openfile1.FileName)
                ListBox1.Items.Add(line)
            Next
        End If

This code serves on windows form, when I use in WPF there are no errors but can not display the contents of the notepad on the listbox. there is no other solution


thanks to Magnus

I did not think his mistake on System.Windows.Forms.DialogResult
thank you very much, the code works.

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>