Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6632047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:37:53+00:00 2026-05-25T22:37:53+00:00

OS: openSuse 11.4 IDE: MonoDevelop 2.4.2 using GTK# I need to display the datatable

  • 0

OS: openSuse 11.4
IDE: MonoDevelop 2.4.2
using GTK#

I need to display the datatable of a sqlite database in a simple grid view, much like in WindowsForms’/WPF’s datagridview, but with GTK#.
I have been trying to configure the GTK.TreeView to display the data properly, but with no luck. The data is not displayed and I get an obscure error in the Application output. Here is my code:

            Type[] types;           
            SqliteCommand cmd = new SqliteCommand("SELECT * FROM "+Tables.USERS, _cddapConn);
            cmd.Connection.Open();
            SqliteDataReader reader = cmd.ExecuteReader();
            types = new Type[reader.FieldCount];        


        for(int i = 0; i < types.Length; i++)
            types[i] = typeof(string);
        Gtk.ListStore list = new Gtk.ListStore(types);

        for(int i = 0; i < TblUsers.SCHEMA.Length; i++)
        {               
            table.AppendColumn(TblUsers.SCHEMA[i], new Gtk.CellRendererText(), "text");
        }
while(reader.Read())
        {
            String[] rowData = new String[TblUsers.SCHEMA.Length];
            for(int index = 0; index < TblUsers.SCHEMA.Length; index++)
            {
                rowData[index] = reader.GetString(index);                   
                table.Columns[index].AddAttribute(new Gtk.CellRendererText(), "text", index);

                }
                list.AppendValues(rowData);


        }
        table.Model = list;
        reader.Close();
        cmd.Connection.Close();

I followed the example given here: http://www.mono-project.com/GtkSharp_TreeView_Tutorial.
First I create the model (ListStore) by initializing it with the string type for the data of every column. Then I append the columns of the data table to the tree view. Then I engage the sqlite reader, and for every entry I add its data to the model. Then I add a cell for each column pointing to the data. Finally, I give the tree view its model.

However, this only manages to display the columns with no data. What I get in the application output is this:

Gtk-CRITICAL **: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed

I spent a few hours looking for any information about this problem with no success. What is surprising is that I found no examples of the treeview being used in mono to display data from a database, or any documentation on gtk# for that matter.

How can I make my grid view work? I really only need it to display the data and accept row selections (so that I can check the ID column of the selected row).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:37:53+00:00Added an answer on May 25, 2026 at 10:37 pm

    I saw the very same as you, Following the GtkSharp TreeView Tutorial gives the exact same assertion and no data in the tree. I think the Assert is a red herring. In any case, I got what you were aiming for with the following code.

      ListStore SetupModel( TreeView tv ){
        var m = new ListStore(typeof(string),typeof(string));
    
        var nameCol = new TreeViewColumn( "Name", 
          new CellRendererText(), "text", 0 );
        tv.AppendColumn( nameCol );
    
        var colourCol = new TreeViewColumn( "Colour", 
          new CellRendererText(), "text", 1 );
        tv.AppendColumn( colourCol );
    
        tv.Model = m;
        return m;
      }
    
      void PopulateData( ListStore model ) {
        model.AppendValues( "Fred", "Blue" );
        model.AppendValues( "Bob", "Green" );
        model.AppendValues( "Mary", "Yellow" );
        model.AppendValues( "Alice", "Red" );
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the openSUSE 11.1 VM with the latest MonoDevelop 2.1 trunk and Moonlight
I'm coding in C++ with OpenSUSE Linux and using Qt Creator as my IDE.
I am using gcc/g++ to compile c/c++ applications - living on OpenSuSe btw. Is
My Environment: I'm using: OpenSuse 11.4 kernel 2.6.x.x; Apache 2.2; PHP 5.3; MySQL 5.5
I am using 32 bit openSUSE OS, and I am using a cross compiler
I need help with a simple c structure and can't find it why it's
I'm trying to analyze a Linux kernel panic on openSUSE 11.3 using kdump and
I'm porting an ASP.NET app to mono 2.8.2 using the openSuse 11.3 VM image
Using openSUSE, I downloaded the Oracle rpms for jdk1.6.0_24 and I want to set
I am developing a GTK# mono application under openSuse, but I am interested in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.