I have a fairly normal grid that I'm running with an OnItemCreated sub. The sub does some really basic things like assign shared calendars to the date pickers and add a "Select an Item" to the combo boxes.
The other thing I have it do is to check one of the fields in each record for a particular value. If that value is not in the table that feeds a combo, it adds it manually to the combo. This works great when editing existing records because I already have an Index for the grid item, however, when adding a new record, my routine errors because the Index hasn't been created yet. I need the Index to perform a query and check for a value.
So what I really need is a way to determine whether or not the index exists when someone clicks on Add a Record. If it doesn't exist, I will just bypass my routine.
Can you help me figure out a way to determine if the item index exists?
This is the line of code that errors:
Dim task_id As String = item.OwnerTableView.DataKeyValues(item.ItemIndex)("task_id").ToString()
Thanks.
The other thing I have it do is to check one of the fields in each record for a particular value. If that value is not in the table that feeds a combo, it adds it manually to the combo. This works great when editing existing records because I already have an Index for the grid item, however, when adding a new record, my routine errors because the Index hasn't been created yet. I need the Index to perform a query and check for a value.
So what I really need is a way to determine whether or not the index exists when someone clicks on Add a Record. If it doesn't exist, I will just bypass my routine.
Can you help me figure out a way to determine if the item index exists?
This is the line of code that errors:
Dim task_id As String = item.OwnerTableView.DataKeyValues(item.ItemIndex)("task_id").ToString()
Thanks.