473,385 Members | 1,757 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.

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 2872
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****************@TK2MSFTNGP10.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****************@TK2MSFTNGP10.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.tablestyle(x).columns though.

For Each oColumn As DataGridViewColumn 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(oColumn.Index).Value)
Dim NewWidth As Single = e.Graphics.MeasureString(S,
oColumn.InheritedStyle.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********@email.com> schreef in bericht
news:EI********************@pipex.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****************@TK2MSFTNGP10.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
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...
0
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...
2
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...
8
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...
1
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...
2
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...
3
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...
4
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...
1
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. -- .....
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...

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.