473,804 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: DataGrid Select

Hi

Can anybody tell me how to prevent multiple selections of rows in a
datagrid?

Also, can anybody tell me if the following are available in the latest
version of the DataGrid i.e. in visual studio 2005?

Auto column width i.e. the width of the column is set according to the data
in each column.

I'd also be interested in any other additions to the DataGrid in the latest
version of Visual Studio.

Thanks in advance

Geoff
Feb 1 '06 #1
4 2889
Geoff wrote:
Hi

Can anybody tell me how to prevent multiple selections of rows in a
datagrid?

Also, can anybody tell me if the following are available in the latest
version of the DataGrid i.e. in visual studio 2005?

Auto column width i.e. the width of the column is set according to the data
in each column.

I'd also be interested in any other additions to the DataGrid in the latest
version of Visual Studio.

Thanks in advance

Geoff


http://www.thescarms.com/dotnet/SingleSelect.asp
Feb 1 '06 #2
Cheers Chris

You don't happen to know a site that describes how to override the DataGrid
so it will auto-size the standard DataGrid as well?

Geoff

"Chris" <no@spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Geoff wrote:
Hi

Can anybody tell me how to prevent multiple selections of rows in a
datagrid?

Also, can anybody tell me if the following are available in the latest
version of the DataGrid i.e. in visual studio 2005?

Auto column width i.e. the width of the column is set according to the
data in each column.

I'd also be interested in any other additions to the DataGrid in the
latest version of Visual Studio.

Thanks in advance

Geoff


http://www.thescarms.com/dotnet/SingleSelect.asp

Feb 1 '06 #3
Geoff wrote:
Cheers Chris

You don't happen to know a site that describes how to override the DataGrid
so it will auto-size the standard DataGrid as well?

Geoff

"Chris" <no@spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Geoff wrote:
Hi

Can anybody tell me how to prevent multiple selections of rows in a
datagrid?

Also, can anybody tell me if the following are available in the latest
version of the DataGrid i.e. in visual studio 2005?

Auto column width i.e. the width of the column is set according to the
data in each column.

I'd also be interested in any other additions to the DataGrid in the
latest version of Visual Studio.

Thanks in advance

Geoff


http://www.thescarms.com/dotnet/SingleSelect.asp



No, and a quick google search didn't show one this time. The question
would be when would you want to do the autosize? I'd guess you'd do it
after the binding, don't know what event that would be though. You
wouldn't want to do it in the paint event, that'd be too often. I can
give you code to help you determine the max length a column needs to
autosize.

Do you have a reason to use the DataGrid? The DataGridView in VS.2005
does have an autosize capability. If you just need to show one table,
it may be a better choice.

Chris
This code gets the max size needed of a datagridview column.
Like I said it does it automatically, but this was for a printing
purpose same concept though. You'll have to convert it to a
datagrid.tables tyle(x).columns though.

For Each oColumn As DataGridViewCol umn In dgvData.Columns
nwidth = 0
For Each oRow As DataGridViewRow In dgvData.Rows
'Format cell just returns a string that has dates formated in a
way I wanted
S = FormatCell(oRow .Index, oColumn.Index,
oRow.Cells(oCol umn.Index).Valu e)
Dim NewWidth As Single = e.Graphics.Meas ureString(S,
oColumn.Inherit edStyle.Font, oColumn.Width). Width
If NewWidth > nWidth Then nWidth = NewWidth
Next
Next
Feb 1 '06 #4
Hi Geof,

Maybe the website from two newbies here

http://www.vb-tips.com/default.aspx?...5-f7841cece67a

I hope this helps,

Cor

"Geoff" <no********@ema il.com> schreef in bericht
news:EI******** ************@pi pex.net...
Cheers Chris

You don't happen to know a site that describes how to override the
DataGrid so it will auto-size the standard DataGrid as well?

Geoff

"Chris" <no@spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Geoff wrote:
Hi

Can anybody tell me how to prevent multiple selections of rows in a
datagrid?

Also, can anybody tell me if the following are available in the latest
version of the DataGrid i.e. in visual studio 2005?

Auto column width i.e. the width of the column is set according to the
data in each column.

I'd also be interested in any other additions to the DataGrid in the
latest version of Visual Studio.

Thanks in advance

Geoff


http://www.thescarms.com/dotnet/SingleSelect.asp


Feb 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1882
by: Stephen | last post by:
Was wondering if it is possible to take the contents of a row in a datagrid and use an event to copy over the details of the selected row into another datagrid. I'd like to be able to do the following: - I have a datagrid on my page which comes back as follows. The addresses are in a column which is databound. I would like to create an event on the on-click of the select link (located in the datagrid). On this event I would like to...
0
2001
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show this table.
2
9931
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
8
3053
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the client-side coding needed for the user to click a "select" button (HTMLButton) in column 0 of the datagrid and have the table objects auto-fill with corresponding values from the dataset row in the datagrid without making a roundtrip to the server. ...
1
4347
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
2
3185
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp, Selecting Rows by Clicking Anywhere). Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
3
2789
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using System.Collections; using System.ComponentModel; using System.Data;
4
3499
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
1
2370
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of
0
2730
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only, cannot serch by combine 3 table) Example I have the query table below, how do I make the code to seach based on the query from this: SELECT Product.ID, Product.Description, Quantity.Quantity, Quantity.SeialNo, Quantity.SupplierID,...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
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...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
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
9177
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...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.