Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i remove the browsing element in a Datagrid?

Status
Not open for further replies.

OrangeWire

IS-IT--Management
Mar 26, 2003
28
US
I have a datagrid that i use to display some DB query results on and when the application loads, i would Like the datagrid to be totally empty.

Instead, the grid loads and has a collapsed tree of my db tables on the second row

looks something like this:

|> +


During run time if you click that + it will drop down a list of the tables in the DB and basically allow someone to browse through.

Can anyone give me some insight on how to disable that collapsed tree, or remove it?


as always, thank you all for taking the time to read and help!

 
you need to set your grid datasource equal to your dataset datatable. ie -

dgMyGrid.datasource = dsMYDataSet.Tables("MyTable")

otherwise, it gives the whole dataset. if you want it to be empty, i think you can do this

dgMyGrid.datasource = Nothing


this should do it.

did this help you? let me know


hayt
 
so that is making it by default load a table into the grid, correct?

Can i simply just turn off the property that shows that or something?

ive been getting the same answer on a few other boards but im unclear as to why peopl ekeep saying set it equal to a table rather than just disable that feature until you do set it equal to a table?
 
that is what setting it to nothing does. it sets it to nothing. then you can set it to a table when you are ready, and back to nothing if you want. but the actual line of code is:

myGrid.datasource = nothing

actually type the word nothing. sorry if i was confusing.


hayt
 
also, you can just not set it on form load, then set it when an event happens. then you can set it back to nothing later.

hayt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top