DataRepeater.NewItemNeeded Event

 

Occurs when the VirtualMode property is set to True and the user creates a new blank DataRepeaterItem.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

public event EventHandler NewItemNeeded
public:
event EventHandler^ NewItemNeeded {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
}
member NewItemNeeded : IEvent<EventHandler,
    EventArgs>
Public Event NewItemNeeded As EventHandler

Remarks

In virtual mode, use this event to add a new record to your data store when the user adds a new item.

When the VirtualMode property is set to False, this event is not raised.

For more information about how to handle events, see Handling and Raising Events.

Examples

The following example demonstrates how to handle the NewItemNeeded event. It assumes that you have a DataRepeater control named DataRepeater1 that has its VirtualMode property set to True, and that you have a data store for a data source named Employees.

private void dataRepeater1_NewItemNeeded(object sender, System.EventArgs e)
{
    Employee newEmployee = new Employee();
    Employees.Add(newEmployee);
    blnNewItemNeedEventFired = true;
}
Private Sub DataRepeater1_NewItemNeeded(
  ) Handles DataRepeater1.NewItemNeeded

    Dim newEmployee As New Employee
    Employees.Add(newEmployee)
    blnNewItemNeedEventFired = True
End Sub

See Also

ItemValueNeeded
ItemValuePushed
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
Virtual Mode in the DataRepeater Control (Visual Studio)

Return to top