Results 1 to 6 of 6

Thread: Hiding a column in Datagrid

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Location
    Plantation, FL (USA)
    Posts
    66

    Hiding a column in Datagrid

    Hi, I am using the following technique to hide a column in a datagrid. It works great, however, I am not able to get the item value anymore by calling

    DataGrid1.Item(DataGrid1.CurrentRowIndex(), 0)

    Is there a way to hide a column using this method and still get the value from the datagrid?
    I do not want to use a Datagrid Table Style

    VB Code:
    1. Dim cn As New SqlConnection("Data Source=MyServer;User Id=MyUser;Password=MyPassword;Initial Catalog=Northwind")
    2. cn.Open()
    3. Dim da As New SqlDataAdapter("Select * From Products", cn)
    4. Dim ds As New DataSet()
    5. da.FillSchema(ds, SchemaType.Source, "Products")
    6. da.Fill(ds, "Products")
    7. ' Next line hides column.
    8. ds.Tables("Products").Columns("QuantityPerUnit").ColumnMapping = MappingType.Hidden
    9. DataGrid1.SetDataBinding(ds, "Products")

    Thanks in advance
    Diego
    Last edited by dterza01; Jun 8th, 2004 at 01:30 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width