Buon Ferragosto a tutti.
come posso bindare ilcoltrollo UltraOptionSet?in questo controllo ho due Item di tipo stringa "Incluso" e "Escluso".nel Record ho il testo "Incluso" o "Escluso".Grazie.
Hi,
I don't speak Italian, but it looks like you are asking how to bind the UltraOptionSet control. Here's some sample code that may help.
private void Form1_Load(object sender, EventArgs e) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("Incluso_Escluso", typeof(string)); dataTable.Rows.Add(new object[] { "Escluso" }); dataTable.Rows.Add(new object[] { "Incluso"}); this.ultraOptionSet1.Items.Clear(); this.ultraOptionSet1.Items.Add("Incluso"); this.ultraOptionSet1.Items.Add("Escluso"); this.ultraOptionSet1.DataBindings.Add("Value", dataTable, "Incluso_Escluso"); }
Private Sub CaricaPreventivo(ByVal pIDPreventivo As Integer) Dim mBsPreventivo As New BindingSource
Dim mSQLSelect As String = "Select * From TbPreventivi where IDPreventivo =" + CStr(pIDPreventivo) Dim cmdPreventivo As New OleDbCommand(mSQLSelect, mCn) cmdPreventivo.CommandType = CommandType.Text Dim cmb As New OleDbCommandBuilder(mdaPreventivo)
mdaPreventivo.SelectCommand = cmdPreventivo mdaPreventivo.UpdateCommand = cmb.GetUpdateCommand
mdaPreventivo.MissingSchemaAction = MissingSchemaAction.AddWithKey mdaPreventivo.Fill(mdtSelect)
optSommelier.DataBindings.Add("Value", mBsPreventivo, "BuffetIniziale_Finale")
End Sub
Private Sub frmPreventivi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
optSommelier.Items.Clear() optSommelier.Items.Add("Incluso") optSommelier.Items.Add("Escluso") CaricaPreventivo(IDPreventivo) End Sub
I think it should be:
optSommelier.DataBindings.Add("Value", mdaPreventivo, "BuffetIniziale_Finale")
thanks Micke.
mdaPreventivo is DataAdapter.
mbs is BindingSource.
does not work