We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

instantiate

Thread ID:

Created:

Updated:

Platform:

Replies:

103031 Mar 25,2012 10:34 PM UTC Mar 30,2012 04:17 AM UTC Windows Forms 3
loading
Tags: GridControl
Anne Thorne
Asked On March 25, 2012 10:34 PM UTC

Hi,

I need to have the ability to create and instantiate Syncfusion.Windows.Forms.Tools.TabPageAdv Tabs dynamically and programmatically at run time depending on user interactions.

Here is the situation. There will be many types of products that a user may add to their order via an application I am writing whose UI uses Syncfusion.Windows.Forms.Tools.TabPageAdv Tabs.

Up until now, I knew what Tabs to have in the UI, but now I don't want to have to code many other potential tabs, if the user is not going to use them.

I want to be able to do something like this:

If the user presses a button (based on other settings the user has indicated elsewhere in the application), I want to do the following:


private void frmEnhancedSetTemplate_btnSubmit_Click(object sender, EventArgs e)
{
string sNameOfNewTabPgAdv = "pg" + frmEnhancedSetTemplate.TypeOfSet + "_" + frmEnhancedSetTemplate.MasterProduct + "_" + frmEnhancedSetTemplate.Currency;

Syncfusion.Windows.Forms.Tools.TabPageAdv sNameOfNewTabPgAdv = new Syncfusion.Windows.Forms.Tools.TabPageAdv();

sNameOfNewTabPgAdv.Location = new System.Drawing.Point(1, 29);
sNameOfNewTabPgAdv.Name = sNameOfNewTabPgAdv;
sNameOfNewTabPgAdv.Size = new System.Drawing.Size(877, 0);
sNameOfNewTabPgAdv.Text = "Standard Cart";
sNameOfNewTabPgAdv.Enabled = false;
this.arbTab1.Controls.Add(this.pgHostSpecial);
sNameOfNewTabPgAdv.Enabled.TabVisible = true;
this.arbTab1.SelectedTab = sNameOfNewTabPgAdv;
}

The problem is that I want to create the new TabPageAdv not within the method, but higher up in the class so it can be accessed throughout the whole class, and I know I can't give name it with a string.. but I want it's name to be dynamic.

I hope this makes sense :(

I may just need to create all possible TabPageAdv Tabs at design time :( but I'd rather not do that.

I hope someone can help me.

Thanks!
:) Anne











Anne Thorne
Replied On March 25, 2012 10:36 PM UTC

Oops I should have named the Subject:

Declare and Instantiate TabPageAdv On the Fly

I thought the form posting utility would let me view my post first.

Thanks!
:) Anne





Anne Thorne
Replied On March 25, 2012 10:41 PM UTC

Wow!!! I'm really not doing very good today in posting this question. Here is better code -- my cut and paste made some errors before in what I was trying to ask:

private void frmEnhancedSetTemplate_btnSubmit_Click(object sender, EventArgs e)
{
string sNameOfNewTabPgAdv = "pg" + frmEnhancedSetTemplate.TypeOfSet + "_" + frmEnhancedSetTemplate.MasterProduct + "_" + frmEnhancedSetTemplate.Currency;

Syncfusion.Windows.Forms.Tools.TabPageAdv sNameOfNewTabPgAdv = new Syncfusion.Windows.Forms.Tools.TabPageAdv();

sNameOfNewTabPgAdv.Location = new System.Drawing.Point(1, 29);
sNameOfNewTabPgAdv.Name = sNameOfNewTabPgAdv;
sNameOfNewTabPgAdv.Size = new System.Drawing.Size(877, 0);
sNameOfNewTabPgAdv.Text = sNameOfNewTabPgAdv;
sNameOfNewTabPgAdv.Enabled = false;
this.arbTab1.Controls.Add(sNameOfNewTabPgAdv);
sNameOfNewTabPgAdv.Enabled.TabVisible = true;
this.arbTab1.SelectedTab = sNameOfNewTabPgAdv;
}

Thank you again for any help anyone can give me.

:) Anne




Arun A [Syncfusion]
Replied On March 30, 2012 04:17 AM UTC

Hi Anne,

Thanks for your interest in Syncfusion products.

I have attached the sample as per your requirements in the following link. Please run the sample and let us know if it helps you.

http://www.syncfusion.com/downloads/Support/DirectTrac/92577/DynamicControl-336807839.zip

Please let us know if you need any other details.

We are glad to help you on this.

Regards,
Arun


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;