• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

DataGrid Question in VB.net - How to get grid to open automatically rather than displaying a plus sign or link to click first to open

I have developed an application along with the help of many of the experts on this site.  One nuiscance in this application which is a Windows app connected to SQL Server 2000, is that the grids force the user to click on a link or plus sign to display the contents of the grid.  I have tried to set up column mapping but it does not appear to make any difference.  I would like to know if there is an easy way to make the grid open automaticlly maybe without mapping each column?  I am mapping the grid to a dataset.  I have an example using a dataview and filter but do not believe I need that.  Can someone provide a sample code snippet?
 
0
garyinmiami2003
Asked:
garyinmiami2003
  • 3
  • 2
1 Solution
 
davidrichardsonCommented:
have you set the datagrid datamember

yourdatagrid.datamember = "YourTable"
0
 
garyinmiami2003Author Commented:
I put the data in a Dataset (dsSrchGrid).  Then made this the datasource like:

 With dgCUSrchGrid1
            .DataSource = dsSrchGrid
            .Expand(0)
end with

If you want me to try datamember can I just put   .datamember = dsSrchGrid.Tales(0) in the "With" statement above?  I have been experimenting with defining the columns which seems to work but it works after the grid is open by clicking on the name.  This is the step I'm trying to eliminate.  Please advise.

 
0
 
davidrichardsonCommented:
you want the name of your table

With dgCUSrchGrid1
            .DataSource = dsSrchGrid
            .DataMember= "YOURTABLENAME"
            .Expand(0)
end with
0
 
davidrichardsonCommented:
This presumes you have added TableMappings to your dataadapter

YOURDATAADAPTER.TableMappings.Add("Table", "YOURTABLE")
0
 
garyinmiami2003Author Commented:
David: thank you!

It worked great.


garyinmiami2003
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now