Welcome to Dream.In.Code
Become a C# Expert!

Join 150,422 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,101 people online right now. Registration is fast and FREE... Join Now!




Combo Box problem

 
Reply to this topicStart new topic

Combo Box problem, Adding items at runtime

DJ-DoSSeR
23 Mar, 2008 - 09:33 AM
Post #1

New D.I.C Head
*

Joined: 23 Mar, 2008
Posts: 1

Hey all, small problem here. I have a combo box on my form that I want to populate at runtime with items that are read from an external file. So when the form loads, the combo box will be populated with the items. My idea was to read each line of the file, adding each item until it reached the end.

At the moment I am trying to read from the file using BinaryReader, and then adding each item as its read, but code just isnt working

CODE


try
{
   fs.Readline(server)
   Combobox1.Items.Add(server)
}



I know the above code is wrong( its an example, as my own code is just as shoddy ), but hopefully somone will understand what I am getting at.

Thanks for any help.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Combo Box Problem
23 Mar, 2008 - 09:48 AM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,327



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
A BinaryReader does not have a ReadLine method. It is specified as Read<data type>, where data type is the value you are reading from the file. Ie.. ReadByte, ReadChar, ReadDouble..etc.

And it is written in the following format:
CODE

server = fs.ReadString

BinaryReader
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:26PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month