|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Q: DataGrid SelectHi
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 Geoff wrote:
Show quoteHide quote > Hi http://www.thescarms.com/dotnet/SingleSelect.asp> > 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 > > 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 Show quoteHide quote "Chris" <no@spam.com> wrote in message news:%23D9ZaIzJGHA.4068@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 Geoff wrote:
Show quoteHide quote > Cheers Chris No, and a quick google search didn't show one this time. The question > > 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:%23D9ZaIzJGHA.4068@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 > > > 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 Hi Geof,
Maybe the website from two newbies here http://www.vb-tips.com/default.aspx?ID=d7d87026-c86b-491c-a535-f7841cece67a I hope this helps, Cor Show quoteHide quote "Geoff" <nodamnspam@email.com> schreef in bericht news:EIadnYIMrvZoJX3eRVnyhg@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:%23D9ZaIzJGHA.4068@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 > > |
|||||||||||||||||||||||