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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET datagrid the right tool? How to put it to best use?

Status
Not open for further replies.

flbos

Programmer
Sep 15, 2005
41
NL
Hi all,

I've got some specific questions about the datagrid. I'm using Microsoft Visual Studio .NET 2003 to develop an application. I'm new to VB.Net and I've got a hard time with the differences between developing with VB.Net and developing with MS Access VBA (the latter I've been using till now on).

I want to offer the users of my application an overview of many records. I figured that the datagrid would be the right tool to do this. However I need to know some things about it before I can actually use it.

The data that I need to view comes from two data sources, 1 Mysql database and 1 other database (this is really nescessary in this case). First I read the records from the Mysql db and after that I add some additional information (in new columns) from the other db. I put the data from the Mysql db and the additional information from the other db together in one dataset (maybe I'm going to use a dataview later on to be able to sort and filter easily) and after that I link the dataset with a datagrid. Now I want the user to be able to edit the data.

Is the datagrid the right tool to use to create the functionality that I need here?

It would be very interesting if I could bind the Mysql data directly to the datagrid so that instant updates are possible. I know how to do this (using a data-adapter) but can I also do this when I add addtional columns (with information from the other db) to the dataset and after that bind it with the datagrid. Would the Mysql data still be updatable directly in this scenario? And more important: how do I get this to work?

I'd also like to know if there is a possibility to trigger a procedure when a field in the datagrid is updated by the user. I would be able to update the data from the other database using this 'after update procedure' if I knew how to do this. So how can I do this?

Another problem that I ran across is that I want the user to be able to edit some of the columns of the datagrid but not all the columns. Is there a way to restrict the editing of the data in the datagrid to only a part of the columns in the datagrid?

The last question (sorry for this long post):
In some situations I need to give the user tha ability to use comboboxes to edit some of the data fields in the list of records that I display. Example, I've got a field status that can only contain certain values ('U', 'F'). Now I want a combobox in each record with 'U' and 'F' in the dropdown list. This can be done easily in MS Access but can this be done in VB.Net too? And can it be done within a datagrid? It would be great if I could display a combobox instead of a text field in each record for a certain column.

Is there someone that wants to answer these questions and get me going with VB.Net? It would really be very much appreciated because I can sure use some advices from more experienced VB.Net developers!
 
Maybe my question was a bit extensive but can someone point me in the right direction?
 
the datagrid is far from perfect and what you are trying to will need some (a lot) of work but is possible just not with the tools at hand. You will have to do most of the work yourself.

create two dataadapter/datatable/command/connection blocks to store the differnt data then make a third datable that combines the two. and bind that to the datagrid. on change of the datagrid write the changes back to the first datatables and updat the database.

You can restrict the input of the data but I'm no datagrid expert.

and combos can definitly be used in a datagrid.

sorry for the short reply MSdatagrids are a thing of the devil.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top