Torna al Thread

Imports System.Data.Sql Imports System.ComponentModel Public Class Form1 Private WithEvents bstemp As BindingSource Public Event AddingNew As AddingNewEventHandler 'codice Private Sub bstemp_AddingNew(ByVal sender As Object, ByVal e As AddingNewEventArgs) Handles bstemp.AddingNew Dim binding As BindingSource = CType(sender, BindingSource) Dim view As DataView = CType(binding.List, DataView) Dim row As DataRowView = view.AddNew() row("testo") = "test" e.NewObject = row binding.MoveLast() End Sub Private Sub Esempio() Dim bstemp As BindingSource bstemp = New BindingSource() 'toggetto è un oggetto estratto da una ricerca mirata che contiene il bindingsource 'e il nome tabella che mi serve estratti dalla lista di oggetti TAbbinamenti bstemp = CType(toggetto.Bindingsource, BindingSource) bstemp.AddNew() bstemp.EndEdit() bstemp = Nothing End Sub End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5