Thread: C# Question
View Single Post
Old 03-19-2009, 02:38 AM   #7 (permalink)
WWS
 
Super Techie

Join Date: Nov 2005

Posts: 270

WWS is on a distinguished road

Default Re: C# Question

the following code works except for one thing, it populates a list box vertically instead of horizontally. I have posted the code below, can someone tell me how to populate the list box horizontally? The text file contains data in the following format x/y/z and I want to show it in the list box as x y z then start a new row that follows the same format.

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
String LB1String = "";

StreamReader objReader = new StreamReader("C:/Data.txt");
{
while (LB1String != null)
{
LB1String = objReader.ReadLine();

String[] txtData;
Char [] Delimiter = new Char []{'/'};

txtData = LB1String.Split(Delimiter, 4);

if ( txtData != null)
{
listBox1.
listBox1.Items.AddRange(txtData);


}
}

}

}
}
__________________
12 Gb GSkill DDR3 Tripple Channel
2 500 Gb SATA II HD
2 BluRay Burners
2 9800GTX+ in SLI
ASUS Rampage II Extreme
Intel Core i7 920 @3.8 GHz

Last edited by WWS; 03-19-2009 at 02:40 AM.
WWS is offline