Need basic help with DataGrid/Listbox controls

G

Guest

I am trying to display some information from a database in a form that
displays one record per line. When the user clicks anywhere on a line, that
record is highlighted and selected, and my program will respond to that. The
problem is that with a listbox control (which is what it sounds like I need),
I can't get the information to format at all. \t-Tabs skew the data
unpredicatably - it leaves some words closer together on some lines than
others. Spaces are not appropriate either because I am trying to get the data
to display in psuedo-columns - ie: last name, firstname, SS, etc. The
DataGrid looks great as far as formatting goes, but when a user clicks on a
DataGrid cell, It just selects that cell, and it highlights the text like it
wants to be edited - even if its a read-only Datagrid. Is there a way to make
rows of a DataGrid select all the way across like data in a ListBox? Or Is
there a way to reliably format the data in a listbox? Right now for the
listbox I am using this:

String listHolder;
foreach(DataRow row in dtaRows)
{
listHolder = row["lastname"].ToString()+ ", \t"+
row["firstname"].ToString()+"\t"+row["middlename"].ToString()+"\t"+row["ss"].ToString();
this.listBox1.Items.Add(listHolder);
}

What are my options??? I can't figure out how to make it do what I'm looking
for with either control. I only need one of them to work. I would definately
prefer the DataGrid though. Any ideas/suggestions? Thanks.

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top