Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can we use the information in the database without display in the DataGridview?

For example:
VB
me.text=DataGridview.Item(0,0).Value


We get this information without use DataGridview.

Basically I want to know
Whether we can call cell in a table or not?(without datagridview)

tanX
Posted
Updated 24-Nov-11 7:14am
v4

DataGrid is just a simple way (a 'shortcut') for retrieving and displaying data. Of course you may connect to the database and retrieve data without using a DataGrid: just use DataSets and DataTables.
There are many tutorial around, see, for instance: "Data Sets and Data Adapters"[^].
 
Share this answer
 
Comments
sara.solati68 24-Nov-11 5:29am    
I totally agree with you.
But Datagridview gives us the following Code:
me.text=DataGridview.Item(0,0).Value
Now Do you can give me value (0,0) of Database with use DataSets and DataTables?
Somehow I get a feeling you are talking about binding...
You can bind to Textboxes just like you can bind to DataGridViews.
VB
TextBox1.Bindings.Add("Text", MyDataSourceObject, "MyDataSourceProperty")
Alternatively you can add Bindings from the Property Grid. Look for (DataBindings).
It is called Simple Binding.
Data binding concepts in .NET windows forms[^]

Alternatively, without binding, you could simply fetch a DataRow from your database and pretty much assign a columns value to your TextBox.Text Property.
 
Share this answer
 
v2
Comments
sara.solati68 23-Nov-11 16:31pm    
I am writing a program that At any time makes many calculations.and Datagridview does work.

While the: Need not user see this part of program.and if i use Datagridview to calculations,program will be so Slow.

Because of this I'm cut.

Moreover:I want to know How can we use the information in the database without display in the DataGridview?
Sander Rossel 23-Nov-11 16:42pm    
I think you have a bigger problem there. Usually, when having long running operations that freeze the UI you have to resort to multi-threading... Which is A LOT harder than simply displaying data in TextBoxes instead of DataGridViews.
Moreover, if you use DataGridViews to store data you are really out of luck. Not only is this a beginners mistake, but it makes multi-threading quite impossible, since threads other than the main thread can't update Controls. You need non-UI Classes (no Controls) to store data and possibly background threads for the calculations. If one or more of the calculations are complete you can synchronize to the UI and update any DataGridView or TextBox you want.
If your data is updated and shared my multiple threads you can get unexpected results and deadlocks if you're not careful. However, if you keep running these calculations on the UI thread your application will continue to freeze, wether the data is visible or not.
Rene Bustos 23-Nov-11 17:57pm    
have you created a COntrol in run-time. only for load the results?? i mean

dim dgrid As DataGridview???
then set the query results to a dgrid then toa textbox???
regards
Sander Rossel 23-Nov-11 18:00pm    
I think you're asking the wrong person. Should ask OP :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900