Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

SplitVertical + C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
obrienkev - 28 Nov 2007 15:15 GMT
Hi,

How do I get data to display in the bottom half of the split pane?

I have 2 separate database queries now and I want the results of the first
one to appear in the top half and the results of the 2nd one to appear in the
bottom half.

Here's my split code...

oWB = (Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
Excel.Window xlWin = oXL.ActiveWindow;
xlWin.SplitVertical = 216f;

then queryA results...

int rowIndex = 2;

foreach (DataRow row in this.myDataSet1.Tables["myTableAdapter"].Rows)
{
string ExcelAccount = row["Account"].ToString();
string ExcelType = row["Type"].ToString();
string ExcelCurrency = row["Currency"].ToString();

oSheet.Cells[rowIndex, 1] = ExcelnAccount;
oSheet.Cells[rowIndex, 2] = ExcelType;
oSheet.Cells[rowIndex, 3] = ExcelCurrency;
rowIndex++;
}

QueryA should display in the top half only.

QueryB(similar code) should then display in the bottom half only.

Following the below example...

http://support.microsoft.com/kb/302084

Thanks.
Bernie Deitrick - 28 Nov 2007 17:40 GMT
Kev,

In Excel code, you would use

   ActiveWindow.SplitRow = 0
   ActiveWindow.SplitRow =  12
   ActiveWindow.Panes(1).ScrollRow = 3
   ActiveWindow.Panes(2).ScrollRow = 23

With variables, something like this:

   lngRowNumOfSplit = 12
   lngTopPaneRowNum = 3
   lngBottomPaneRowNum = 35

   ActiveWindow.SplitRow = 0
   ActiveWindow.SplitRow =  lngRowNumOfSplit
   ActiveWindow.Panes(1).ScrollRow = lngTopPaneRowNum
   ActiveWindow.Panes(2).ScrollRow = lngBottomPaneRowNum

How to convert that to C# is up to you.

HTH,
Bernie
MS Excel MVP

> Hi,
>
[quoted text clipped - 36 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.