468,107 Members | 1,328 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

Need basic help with DataGrid/Listbox controls

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
Nov 16 '05 #1
1 1972
Hi,

If you mean no current cell (whole row is selected), I'm just adding it to
my grid.

You may try out (free open source master/detail gird):
(grid.gif picture of grid; lumisoft.grid.zip sample app + grid)
http://www.lumisoft.ee/lsWWW/download/downloads/UI/NET/

"ericm1155" <er*******@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
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

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jaleel Syed via .NET 247 | last post: by
11 posts views Thread by Larry | last post: by
4 posts views Thread by Pacific Design Studios | last post: by
1 post views Thread by JMann101 | last post: by
4 posts views Thread by Brandon Potter | last post: by
11 posts views Thread by CM Manager via DotNetMonster.com | last post: by
6 posts views Thread by Cralis | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.