473,796 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.I tems.Add(listHo lder);
}

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 2217
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.z ip sample app + grid)
http://www.lumisoft.ee/lsWWW/download/downloads/UI/NET/

"ericm1155" <er*******@disc ussions.microso ft.com> wrote in message
news:61******** *************** ***********@mic rosoft.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.I tems.Add(listHo lder);
}

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
4111
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
0
1156
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 EditTemplate, I have a DropDownList with AutopostBack Trueand I have also defined a SelectIndexChanged event Handler forit. Along with the DropDownList, I also have a two ListBoxes andAdd and Remove Buttons. The first ListBox should be filleddepending...
11
2148
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 Reserve unit.) I need a textbook recommendation for a particular need. As I have delved into ASP.Net I find that I want to teach the course by emphasizing coding in the code behind pages but most of the books targeted at beginners to ASP use...
4
2211
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 form 1. Is there a Id in the datagrid I can use to find out which user was selected or which record was highlighted when double clicked. Something like: John Thomas Employee Id 2637 was selected on Form1 and the recordset on Form2 would use...
1
2886
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 is added to that column/row. When the admin clicks "update" I am unable to retrieve the values that were selected from that listbox. Basically, This is a multi-select listbox, so I need to loop to pull all selected items. This is the only...
4
5474
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 structure items in a listbox into "columns" by comparing the string length and adding white space but I was at some point able to do it similar to a DataGrid with the ListBox look. Does anyone have this code? Thanks, Brandon
1
1182
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 DOES WORK, but not quite in the way I want to. My management object is defined like this: Dim disk As New ManagementObject(myScope, New ManagementPath("win32_operatingsystem='TheMachine'"), Nothing)
11
2057
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. Hopefully someone here can help. I am just learning VB.NET and purchased the SAM's "Teach Yourself VB.NET 2003 in 21 days' book. I am trying to connect to an Access database I created locally on my computer per Chapter 16. I originally had it on a...
6
1971
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 quiet and smiled. What is reflection!? I have been reading it up, and all I can work out is that it has something to do with Late Binding, and the use of GetType and Type.
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.