Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default receiving drag-n-drop from PivotTable field list

I'm able to receive drag-n-drop from the PivotTable field list. However, the
data I get on the drop event is a MemoryStream with 12 bytes. See the code
below for an example of the byte array.

What is that drop data? How can I interpret it or load it into the
appropriate structure or detect which field was dropped?

private void txtCalcFormula_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}

private void txtCalcFormula_DragDrop(object sender, DragEventArgs e)
{
try
{
e.Effect = DragDropEffects.All;
if (e.Data is System.Windows.Forms.DataObject)
{
string sFormat = "Excel_Pivot_Table_Fieldlist_Format";
DataObject dataObj = (DataObject)e.Data;
if (e.Data.GetDataPresent(sFormat))
{
//receives a MemoryStream which is 12 bytes similar
to:
//4 144 97 9 215 0 0 0 228 60 0 0
System.IO.MemoryStream stream =
e.Data.GetData(sFormat) as System.IO.MemoryStream;
StringBuilder sb = new StringBuilder();
foreach (byte b in stream.ToArray())
{
sb.Append((int)b).Append(" ");
}
stream.Close();
MessageBox.Show(sb.ToString());
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
}
}
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot ... Drag Multiple Fields from Field List? Ken Excel Discussion (Misc queries) 1 November 12th 09 06:50 AM
PivotTable Field Value List Update Hutch Excel Discussion (Misc queries) 0 August 1st 08 04:46 AM
Corresponding Data From PivotTable Field List DtTall Excel Programming 0 July 18th 07 05:56 PM
Drag and Drop from List to Tree View ExcelMonkey Excel Programming 1 March 30th 07 03:42 AM
Can I alphabetize a PivotTable Field List? Natalie 1229 Excel Discussion (Misc queries) 0 August 7th 06 10:14 PM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"