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

Help Implementing datagridview as data entry

Status
Not open for further replies.

malaygal

IS-IT--Management
Feb 22, 2006
192
US
I am trying to implement this functionality in a data entry form for my application.
The form will have a datagridview (dtgOffices) with 8 columns..
First column is a datagridviewtextboxcolumn, three datagridviewcombobox columns and another datagridviewtextboxcolumn, that will indicate if this is an existing office. The last columns are the dataentry text columns.
Onchange of value of the 1st column (Office ID), a datatable will be generated containing the records that will populate the 2nd (Region), 3rd (State),
and City (4th) comboboxes. When a Region is selected from the drop-down, only the State belonging to that Region should be available in the State combobox .. and so on and so forth.
After, if no record for this ID, 5th column will have an "N".

I was able to add a first row (Region only, for now, will take take of the rest once resolved) for an exisitng office ID
But when I entered non-existent office ID on the 2nd row data entry, the Region combobox is still populated with item from the previous tax id.

This is my Code:

Dim bsOffice as new BindingSource

if dtOffice.rows.count > 0 then 'this is the datatable that has the Region, State, and Cith info for a particular office ID, office ID has multiple Regions, States and Cities

bsOffice.DataSource = dtOffice

Dim cboRegion As DataGridViewComboBoxColumn = DirectCast(dtgOffices.Columns("Region"), DataGridViewComboBoxColumn)
cboRegion.DisplayMember = "RegionName"
cboRegion.ValueMember = "RegionID"
cboRegion.DataSource = bsOffice

Else
bsOffice.DataSource = Nothing
Exit Sub
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top