Avatar of Ken808
Ken808
Flag 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?
Visual Basic.NET.NET Programming

Avatar of undefined
Last Comment
Mike Tomlinson

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy