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. Image for the cookie policy date

Excel like Workbook -

I see the workbook sample that gives youa a multiple spreadsheet feel. A few questions: 1. If I am going to have 30+ sheets is it better to use the workbook feature (as in the sample) or have a tab control where i only have 1 grid control that gets moved around to each tab when i click on it (are there any samples like this). is this more efficient because i only have one control. 2. How can i programatically add "sheets" to the workbook. Assume i have a button and a textbox on top and when i click on the button i get a new tab where the sheet name is the text in the textbox. thanks, ak

3 Replies

AD Administrator Syncfusion Team July 12, 2005 05:31 PM UTC

1) What is going to hold your data? If the grid is to hold the data (using a non-virtual GridControl), then using multiple grid is as easy as anything. But if you are going to use a GridDataBoundGrid and have the data stored in multiple Datatables, then you could probably get away with using a single grid. When you changed tabs, you would have to set the grid.DataSource property to the proper DataTable. You would also have to have some formatting code that would do page dependent formatting if you have any. 2) Here is a button handler that will add a tabpage.
private void button1_Click(object sender, System.EventArgs e)
{
	Syncfusion.Windows.Forms.TabBarPage page = 
				new Syncfusion.Windows.Forms.TabBarPage();
	page.Text = this.textBox1.Text;
	this.tabBarSplitterControl1.TabBarPages.Add(page);

	//activate it it desired
	this.tabBarSplitterControl1.ActivePage = page;
}


AD Administrator Syncfusion Team July 13, 2005 04:28 AM UTC

Answer to Question 1: I am using a virtual grid where most of my grid is user input. I am using QueryCellinfo and SaveCellinfo to get data back and forth from the grid and my data structures. Please let me know your recommendation in this case. thanks, ak >1) What is going to hold your data? If the grid is to hold the data (using a non-virtual GridControl), then using multiple grid is as easy as anything. > >But if you are going to use a GridDataBoundGrid and have the data stored in multiple Datatables, then you could probably get away with using a single grid. When you changed tabs, you would have to set the grid.DataSource property to the proper DataTable. You would also have to have some formatting code that would do page dependent formatting if you have any. > >2) Here is a button handler that will add a tabpage. > >
>private void button1_Click(object sender, System.EventArgs e)
>{
>	Syncfusion.Windows.Forms.TabBarPage page = 
>				new Syncfusion.Windows.Forms.TabBarPage();
>	page.Text = this.textBox1.Text;
>	this.tabBarSplitterControl1.TabBarPages.Add(page);
>
>	//activate it it desired
>	this.tabBarSplitterControl1.ActivePage = page;
>}
>


AD Administrator Syncfusion Team July 13, 2005 07:56 AM UTC

In this case, I would probably try using a common grid. Especially if your datastructures as indexed (or something) so that the same QueryCellInfo/SaveCellInfo/QueryColCount/QueryRwoCount code will work just by changing one or two parameters. If these routines require a great deal of custimization for each tab, then I might be inclined to use a separate grid for the tabs that require customization. Additionally, if you choose to use a grid among two or more tabs, you would also have to add some data structures to hold information that you might want to persist between tab visits, like the current cell location, TopRowIndex, LeftColIndex and Selections.Ranges (and maybe other properties). Of course, if you use separate grids for each tab, you would not need to worry about persisting these properties.

Loader.
Live Chat Icon For mobile
Up arrow icon