Getting tables from dataset

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lolo
Newbie
Newbie
Posts: 11
Joined: Thu Jan 08, 2009 12:00 am

Getting tables from dataset

Post by lolo » Wed Feb 23, 2011 7:32 pm

Hi forum

i have a problem with this fffff components. I have lost my day, trying to solve this, but is not possible. I know i have asked this before, but the problem is still here.

I have a user control in my project.

by code, I have the next

Code: Select all

public class Graph : UserControl
{
        private DataSet _ds;

        pubic Graph(DataSet ds)
        {
           this._ds = ds;

            InitializeComponent();
            MyInit();
        }

        private void MyInit()
        {
            tchart1 = new TChart();
            tchartController1 = new ChartController();

            tchart1.Dock = DockStyle.Fill;
            tchart1.Axes.Left.Automatic = false;
            tchart1.Axes.Left.Maximum = 1;

            tchart1.Axes.Bottom.Automatic = false;
            tchart1.Axes.Bottom.Maximum = 1;

            tchartController1.Chart = tchart1;
         
            this.Controls.Add(tchart1);
            this.Controls.Add(tchartController1);
        }
}
Now, I go to the Editor of the chartcontroller, press Add button to add a new serie. Until here, is ok.
Now, I select the new serie a go to tab Series>Datasource and chooses Database as Datasource, but in the dropdownlist dataset i cannot find the tables.

I have tryed all:

with the tutorial "Connecting to ADO.NET sources at run-time"
with singlerecord
with crosstab

, but have been impossible.

what I need is only something like:

tchart.datasource = dataset; or
tchartcontroller.datasource = dataset;

Somebody can tell, whether is possible to get this tables in a comprensible way.

Thankyou

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Getting tables from dataset

Post by Sandra » Thu Feb 24, 2011 11:36 am

Hello lolo,

If you use Winforms as host of your User control, you need create DataSet in WinForms project, if you want this works correctly. You can do something as next example:
Host project WinForms code :

Code: Select all

       public Form1()
       {
            InitializeComponent();
            InitializeOther();
       }

    private UserControl1 control;
    private DataSet ds;
    private void InitializeOther()
    {
       ds = new DataSet();
       control = new UserControl1();
       control.Dock = DockStyle.Fill;
       Controls.Add(control);
    }
User Control form code:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.TChart tchart1;
        Steema.TeeChart.ChartController tchartController1;
        private DataSet ds;
        private void InitializeChart()
        {
            tchart1 = new Steema.TeeChart.TChart();
            tchartController1 = new Steema.TeeChart.ChartController();
            tchart1.Dock = DockStyle.Fill;
            tchart1.Axes.Left.Automatic = false;
            tchart1.Axes.Left.Maximum = 1;

            tchart1.Axes.Bottom.Automatic = false;
            tchart1.Axes.Bottom.Maximum = 1;

            tchartController1.Chart = tchart1;

            this.Controls.Add(tchart1);
            this.Controls.Add(tchartController1);
        }
Could you confirm us if previous code works as you want?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

lolo
Newbie
Newbie
Posts: 11
Joined: Thu Jan 08, 2009 12:00 am

Re: Getting tables from dataset

Post by lolo » Fri Feb 25, 2011 9:21 am

Hi Sandra

Thank you very much.

I have tested this code and works perfectly.

Thanks again.

Post Reply