473,385 Members | 1,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2171
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
0
by: Jaleel Syed via .NET 247 | last post by:
Hi, I have a Search page, which has a Search Button which whenclicked, Binds a DataGrid to the Data returned from Search(whichimplies that I am not Binding the Grid in Page_Load method). Inthe...
11
by: Larry | last post by:
I will be teaching an eCommerce application development course using ASP.Net after many years of having taught classic ASP. (Course was interrupted by 18 months in the Middle East with my Army...
4
by: Pacific Design Studios | last post by:
I have a DataGrid on Form1 that displays a small amount of information about employees. On Form2 I want to have all the data displaying in text boxes about the employee selected in the datagrid on...
1
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control...
4
by: Brandon Potter | last post by:
I think I'm going crazy, but I cannot remember how to create a listbox with multiple columns as well as the sortable header block (a la Outlook message list). I've seen the examples of how to...
1
by: R Hedges | last post by:
Hi there-I'm an AMATEUR VB.NET programmer, who has hacked together a small VB.NET application that can get information from remote machines using the System.Management namespace. MY APPLICATION...
11
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.