[Gtk-sharp-list] Is there an sample on how to fill a
ComboBoxEntry with data from ADO.Net?
Gaëtan Frenoy
gaetan at frenoy.net
Fri Mar 10 03:20:31 EST 2006
Hi,
Le Thu, 9 Mar 2006 17:26:40 -0300, Victor Rafael Rivarola Soerensen
(FANATICO y LOCO por Cristo) a écrit:
> I have spent the last few days trying to fill a simple combo box with
> data from a database but without success. Is there any free software
> out there that does this under Mono and Gtk#?
I would assume that below example should do it but I could make
it to work as well, at runtime, I receive the following error :
(<unknown>:2900): Gtk-CRITICAL **: gtk_tree_row_reference_new: assertion `GTK_IS
_TREE_MODEL (model)' failed
(<unknown>:2900): Gtk-CRITICAL **: gtk_tree_row_reference_new_proxy: assertion `
GTK_IS_TREE_MODEL (model)' failed
(<unknown>:2900): Gtk-CRITICAL **: gtk_cell_view_set_displayed_row: assertion `G
TK_IS_TREE_MODEL (cell_view->priv->model)' failed
I guess my ComboBox is not properly initialized or something
but did not find out the reason.
Comments are welcome.
Have a great day
Gaëtan
(note:only relevant part of code given)
[Glade.Widget] protected Gtk.ComboBox comboboxSeason = null;
public void FillSeasonList()
{
// Remove all items from list
comboboxSeason.Clear();
int selectedSeason = 0;
int currentPosition = 0;
// Read database entries
foreach (Season season in DbManager.getSeasons())
{
comboboxSeason.InsertText(currentPosition, season.Name);
// Select the current season
if (DateTime.Now >= season.StartDate &&
DateTime.Now < season.StopDate)
{
selectedSeason = currentPosition;
}
currentPosition++;
}
// Select season
comboboxSeason.Active = selectedSeason;
}
More information about the Gtk-sharp-list
mailing list