Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DataGrid Properties of OleDBDataAdapter

Author  Topic 

Richard Branson
Yak Posting Veteran

84 Posts

Posted - 2005-10-14 : 08:20:37
Hey guru's

I am having difficulty changing the properties of a datagrid when populating it with data from a OleDBDataAdapter (Ms Access). When using the FILL method and just the Dataset:
OleDbDataAdapter1.Fill(DsFixedAsset) it works fine and obviously the layout is quite simple, but when I try to use the following code it does not even change the DataGrid one bit. the OleDBDataAdapter was created using the wizzard. Where/ in the code do you do the proerty update. I toltally new to Access with .NET

'Set the Datagrid properties...
DataGrid1.DataSource = DsFixedAsset
DataGrid1.DataMember = "master1"

'Declare objects for the Grid...
Dim grdTableStyle As New DataGridTableStyle
Dim grdTextCol As New DataGridTextBoxColumn

'Set the AlternatingBackColor property...
grdTableStyle.MappingName = "master1"

'Set mapping name for the first column...
grdTextCol.MappingName = "Description"
'Set the new HeaderText...
grdTextCol.HeaderText = "Asset Description"
'Set the width of the column...
grdTextCol.Width = 304
'Add the column to the DataGridTableStyle
grdTableStyle.GridColumnStyles.Add(grdTextCol)

'Add the DataGridTableStyle to the DataGrid...
DataGrid1.TableStyles.Add(grdTableStyle)


Any help or suggestions? The code I put in after I do the FILL. Is it wrong?stupid question!

You can't teach an old mouse new clicks.
   

- Advertisement -