Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Binding CheckBox
lunedì 21 febbraio 2005 - 16.37
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
nothorius
Profilo
| Newbie
22
messaggi | Data Invio:
lun 21 feb 2005 - 16:37
Salve a tutti.
Ho inserito in una tabella dei campi checkbox , ma ho riscontrato dei problemi :
1) quando ho cercato di effettuare l'aggiornamento del dataset tramite il dataadapter mi è stato restituito un errore perf quanto riguarda UPDATE e DELETE.
2) Se cerco di effettuare una di queste due operazioni mi viene restituito un errore.
Qualcuno può aiutarmi? Credo di dover modificare il codice per queste due operazioni ma come si fa?
Grazie in anticipo er l'aiuto.
Cteniza
Profilo
| Guru
1.509
messaggi | Data Invio:
lun 21 feb 2005 - 17:23
Devi intercettare gli eventi Format e Parse esempio:
dBi = new Binding("Checked",this.dsTabe,"Numeratori.Tiponum");
dBi.Format += new ConvertEventHandler(FormatHandler);
dBi.Parse += new ConvertEventHandler(ParseHandler);
// ckAnno è un checkbox che nel database ha un valore boolean (bit)
this.ckAnno.DataBindings.Add(dBi)
...
private void FormatHandler(object sender, ConvertEventArgs e)
{
if (DBNull.Value == e.Value)
e.Value = false;
}
private void ParseHandler(object sender, ConvertEventArgs e)
{
if (e.Value == DBNull.Value)
e.Value = false;
nothorius
Profilo
| Newbie
22
messaggi | Data Invio:
mar 22 feb 2005 - 11:18
grazie cteniza , ma hai l'esempio in vb.net
Cteniza
Profilo
| Guru
1.509
messaggi | Data Invio:
mar 22 feb 2005 - 11:38
L'esempio tradotto in vbdotnettese :))
Private Sub BindControls()
dBi = New Binding("Checked", Me.dsTabe, "Numeratori.Tiponum")
AddHandler dBi.Format, AddressOf FormatHandler
AddHandler dBi.Parse, AddressOf ParseHandler
Me.ckAnno.DataBindings.Add(dBi)
End Sub
Private Sub FormatHandler(ByVal sender As Object, ByVal e As ConvertEventArgs)
If DBNull.Value = e.Value Then
e.Value = False
End If
End Sub
Private Sub ParseHandler(ByVal sender As Object, ByVal e As ConvertEventArgs)
If e.Value = DBNull.Value Then
e.Value = False
End If
End Sub
nothorius
Profilo
| Newbie
22
messaggi | Data Invio:
gio 24 feb 2005 - 15:02
Grazie cteniza , provo e ti faccio sapere
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !