Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Saving ItemInplaceEdited data (Read 4596 times)
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Saving ItemInplaceEdited data
Dec 31st, 2007 at 12:06pm
Print Post  
I am trying to get my app to verify and save the data that a user simply types into the schedule.

I have found that after the user presses the Enter key the calTimeTableView.ItemInplaceEdited event is fired.

So I put this code in this event:

Code
Select All
' update calendar tables in database
	  Me.calTimeTableView.SaveToDataSource(Me.ReminderTableAdapter1, Me.StyleTableAdapter1, Me.CustomBrushesTableAdapter1, Me.ContactTableAdapter1, Me.LocationTableAdapter1, Me.ResourceTableAdapter1, Me.TaskTableAdapter1, Me.ItemTableAdapter1, Me.ItemContactsTableAdapter1, Me.ItemResourcesTableAdapter1, Me.RecurrenceTableAdapter1, Me.RecurrenceExceptionTableAdapter1, Me.RecurrenceExceptionsTableAdapter1)

 ' force calendar to redraw

	 calTimeTableView.Invalidate()

 



but I get an INdexOutOfRange error:

Index -1 is either negative or above rows count.

However the data gets saved to my Item and Style tables, which are the only ones in use at present.

If I include this:

Code
Select All
Me.calTimeTableView.Schedule.Items.Add(e.Item)
 



I get an error stating the item already exists in the schedule.....I understand that error but not the index out of range?

Help please anyone.... Sad
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Saving ItemInplaceEdited data
Reply #1 - Dec 31st, 2007 at 12:51pm
Print Post  
I found after checking one of my other posts that I needed to point to the correct location, which I have now done but I still get the error?

If I drag an item and drop it on the schedule all works well.

If I manually type an item on the schedule I get the index out of range error, but the data does save?

I compared the item and style table and see no difference in values in the fields so cannot see where it is going wrong?

I only use item and style all other tables are empty and the refrenced fields in the item table say null for both dropped and typed entries????

The error does not help much from the savetodatasource method, it would be handy if it said which table it was having the problem with?



  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Saving ItemInplaceEdited data
Reply #2 - Dec 31st, 2007 at 2:19pm
Print Post  
Curious!

After much tracing I found that if you drag and drop onto the schedule the Resource count for that item is zero.

However if you click on any cell and type the Resource count is 1.

It is this which is causing the problem.

I entered this code and the error is gone! Smiley

Code
Select All
If e.Item.Resources.Count > 0 Then

   Dim x As Integer

   For x = 0 To e.Item.Resources.Count - 1

	e.Item.Resources.RemoveAt(x)

   Next

End If
 



Question is why does the Resource count get set to 1 when typing manually onto the schedule?

Is this correct or is it a bug?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Saving ItemInplaceEdited data
Reply #3 - Jan 2nd, 2008 at 6:11am
Print Post  
If in-place create a new item (by selecting and typing) in a grouped view (such as the Resource view) the new item is automatically associated with the resource in which it is created (hence the Resources count is 1).

As for the error that occurs while saving items associated with resources, I will have to check this out.

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Saving ItemInplaceEdited data
Reply #4 - Jan 2nd, 2008 at 7:08am
Print Post  
I see.

I have the tableview grouped by location re a previous post so that explains that.

I will wait to see what you come up with re the error

Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint