Link to home
Start Free TrialLog in
Avatar of Ken808
Ken808Flag for Ireland

asked on

Can you Use StreamReader In Public Module / Function- I'm trying Loading Text Files In to a Combo Box vb.net

Hi Guys,

I have a program I'm working on with multiple combo boxes on multiple forms. A lot of the combo boxes are labeled the same name. Ie ComboBox1.

Can you Use StreamReader In Public Module / Function

 I'm trying Loading Text Files In to a Combo Boxes. I have multiple forms with same combo boxes. I would like to reduce the amount of code im using...

This is an example of how im reading my text file in to the combo box.

   Dim objReader_TextFile1 As New System.IO.StreamReader("c:\\Text_Files\TextFile1.txt")
             
                    Do While Not objReader_TextFile1.EndOfStream
                ComboBox1.Items.Add(objReader_TextFile1.ReadLine)
            Loop
            objReader_TextFile1.Close()

Or is there a better / different way of doing this?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial