How to fill ComboBox with Text File
Fill a ComboBox quickly by importing data from a Text File


SQL Server Developer Edition 2012
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click Dim oStream As IO.StreamReader Dim oOpenFileDialog As OpenFileDialog oOpenFileDialog = New OpenFileDialog oOpenFileDialog.SupportMultiDottedExtensions = False If oOpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then If IO.File.Exists(oOpenFileDialog.FileName) Then oStream = New IO.StreamReader(oOpenFileDialog.FileName) 'Read all lines and add them into the ComboBox1 Do Until oStream.EndOfStream = True ComboBox1.Items.Add(oStream.ReadLine) Loop oStream.Close() 'very important to close the file End If End If End Sub |
0 Response to "How to fill ComboBox with Text File"
Posting Komentar