3 datagridviews on 1 screen - How do I update?

ppirates

Member
Joined
Jul 19, 2006
Messages
12
Programming Experience
10+
I am having problems updating 3 datagridviews that I have on the one screen, or any one of them individually.

I am using VB 2005 and an Access database.

The screen shows 3 lists of price rates in datagridviews, these are split into 3 to show 3 categories, and so that they can all be seen on the one screen.

I can get the data to populate ok, using the code below, but I can't get the database to update.

Dim VehLabDT AsNew DataTable()
VehLabDT = Me.RateCardTableAdapter.GetRateCardByCustIDandType(c lsGlobal.CustID, "V")

' Set data source for HistoryBindingSource
RateCardBindingSource.DataSource = VehLabDT

' Set the data source for dgvVehLab to RateCardBindingSource.
dgvVehLab.DataSource = RateCardBindingSource

The other examples of the 3 sets of population of the datagridviews is very similar to the above.

I was trying to use the following code to do the update....

Me.RateCardTableAdapter.Update(VehLabDT)

Can anyone help me with this please?

Thanks
Colin
 

ppirates

Member
Joined
Jul 19, 2006
Messages
12
Programming Experience
10+
There was no error message initially, the update just hadn't been done.

I think that this was due to the fact that I had set up a new variable at the top of my code like this....

Public VehLabDT As New DataTable

I now realise that that would have been the one that the update code was trying to use, and that the locally declared Datatable was being ignored.

However, that now brings into question how I have public declared datatables being set up in my code, where I am populating the dgv's. And whether these will update using the update code from my save button.

Sorry for being a bit vague or stupid here, I am pretty new to VB.

Thanks for your time.
Colin

 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,053
Programming Experience
10+
Save All
Quit VS2005
Delete the BIN and OBJ folders from the project (they autogenerate)
Zip it up
Attach it to your post


Remember to include the database file
Remove any references to custom controls/libraries I wont have (if I cant load your project to take a look, i wont spend hours or $$ faffing around trying) and ensure your app will run without them
 
Top Bottom