Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

Clipboard and CSV (CommaSeparatedValue) does not work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 23 Jul 2004 15:35 GMT
I am simply trying to write CSV data to the the clipboard.  The code
below is not working.  Any suggestions?

       Dim data As New DataObject
       Dim ms As New MemoryStream
       Dim sw As New StreamWriter(ms)

       sw.Write("Tom")
       sw.Write(",")
       sw.Write("Jones")
       sw.Write(",")
       sw.Write(100)
       sw.WriteLine()
       sw.Write(Chr(0))
       sw.Close()

       data.SetData(DataFormats.CommaSeparatedValue, ms)
       Clipboard.SetDataObject(data, False)

       ms.Close()

THANKS
Bob
ClayB [Syncfusion] - 23 Jul 2004 16:48 GMT
This seemed to work for me.

      Dim data As New DataObject
       Dim sb As New System.Text.StringBuilder
       sb.Append("Tom")
       sb.Append(",")
       sb.Append("Jones")
       sb.Append(",")
       sb.Append("100")
       sb.Append(Environment.NewLine)
       'sb.Append(Chr(0))
       data.SetData(DataFormats.CommaSeparatedValue, sb.ToString())
       Clipboard.SetDataObject(data)

To retrieve it:
       Me.TextBox1.Text =
Clipboard.GetDataObject().GetData(DataFormats.CommaSeparatedValue).ToString(
)

=================================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

> I am simply trying to write CSV data to the the clipboard.  The code
> below is not working.  Any suggestions?
[quoted text clipped - 19 lines]
> THANKS
> Bob
Bob - 23 Jul 2004 18:14 GMT
Clay thanks for the help. I tried your code and my clipboard viewer
displays the CSV data just fine.  However, I can not past this into
Excel, Word, or Notepad.  I am using CSV to alow some records to be
copied to other applications.  Any further suggestions?

Again thanks,
Bob
ClayB [Syncfusion] - 24 Jul 2004 01:09 GMT
Here is a FAQ that has code snippets that use CSV clipboard formats.

    How do I use the CSV clipboard format supported by Excel?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/899.asp

=============================================
Clay Burch, .NET MVP

Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials

> Clay thanks for the help. I tried your code and my clipboard viewer
> displays the CSV data just fine.  However, I can not past this into
[quoted text clipped - 3 lines]
> Again thanks,
> Bob

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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.