473,378 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Clipboard to DataTable

I want to make a class that basically looks at the clipboard, and for the
standard types of clipboard objects (csv,text, etc), create a DataTable from
it. Not all formats will be supported but as many as possible. The idea is
to be able to convert the clipboard into a DataTable, and then pass the
DataTable to another class to do some work on it.

I have started the class here:
http://www.theoren.com/DanH/ClipBoardDataTable.cs

Right now, it only supports the DataFormats.CommaSeparatedValue which is
great for Excel.

The work I have done so far is a port of the vb.net project found here:
http://www.codeguru.com/vb/controls/...cle.php/c6393/

I am looking for some advice or examples that show how to convert the
following DataFormats into a DataTable or DataSet

FileDrop
Html
Text
UnicodeText

Perhaps this code would be useful to others as well so if i can support a
couple more DataFormats, I will share on CodeProject.com or similar.

Thanks,
Dan

Nov 17 '05 #1
3 10052
Dan,

You are going to have to be a little more specific.

For example, if you do a file drop, text, or unicode text, is it assumed
that the file, or the string in the text is the XML that represents the data
set? Or is it just a random file, random strings? If it is the latter,
then you can not create a data set, since those things don't have the
structure necessary for one.

The same goes for HTML. How does one map HTML to a dataset? There
isn't anything that does this by default.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Da********@nospam.nospam> wrote in message
news:9F**********************************@microsof t.com...
I want to make a class that basically looks at the clipboard, and for the
standard types of clipboard objects (csv,text, etc), create a DataTable
from
it. Not all formats will be supported but as many as possible. The idea
is
to be able to convert the clipboard into a DataTable, and then pass the
DataTable to another class to do some work on it.

I have started the class here:
http://www.theoren.com/DanH/ClipBoardDataTable.cs

Right now, it only supports the DataFormats.CommaSeparatedValue which is
great for Excel.

The work I have done so far is a port of the vb.net project found here:
http://www.codeguru.com/vb/controls/...cle.php/c6393/

I am looking for some advice or examples that show how to convert the
following DataFormats into a DataTable or DataSet

FileDrop
Html
Text
UnicodeText

Perhaps this code would be useful to others as well so if i can support a
couple more DataFormats, I will share on CodeProject.com or similar.

Thanks,
Dan

Nov 17 '05 #2
Nicholas,
Great question!

You are right, not all formats can be "easily" translated to a DataSet. The
CSV format is great because you can easily do this:

StreamReader srReadExcel = new
StreamReader((Stream)dataObject.GetData(DataFormat s.CommaSeparatedValue));

To clarify, I am looking for advice on how i can "check" if whats on the
clipboard is in a format one could create a dataTable from. I am not
necessarily looking for code but perhaps just a conversation on approach.

In a perfect world, perhaps someone has some assumptive code about a
particular format that allows them to make a datatable from it. Anyone?

Thanks!!!!
Dan
"Nicholas Paldino [.NET/C# MVP]" wrote:
Dan,

You are going to have to be a little more specific.

For example, if you do a file drop, text, or unicode text, is it assumed
that the file, or the string in the text is the XML that represents the data
set? Or is it just a random file, random strings? If it is the latter,
then you can not create a data set, since those things don't have the
structure necessary for one.

The same goes for HTML. How does one map HTML to a dataset? There
isn't anything that does this by default.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Da********@nospam.nospam> wrote in message
news:9F**********************************@microsof t.com...
I want to make a class that basically looks at the clipboard, and for the
standard types of clipboard objects (csv,text, etc), create a DataTable
from
it. Not all formats will be supported but as many as possible. The idea
is
to be able to convert the clipboard into a DataTable, and then pass the
DataTable to another class to do some work on it.

I have started the class here:
http://www.theoren.com/DanH/ClipBoardDataTable.cs

Right now, it only supports the DataFormats.CommaSeparatedValue which is
great for Excel.

The work I have done so far is a port of the vb.net project found here:
http://www.codeguru.com/vb/controls/...cle.php/c6393/

I am looking for some advice or examples that show how to convert the
following DataFormats into a DataTable or DataSet

FileDrop
Html
Text
UnicodeText

Perhaps this code would be useful to others as well so if i can support a
couple more DataFormats, I will share on CodeProject.com or similar.

Thanks,
Dan


Nov 17 '05 #3
The only way to do this would be to try and load the file, string, HTML,
whatever into a DataTable. If it blows up, then you know it can't be
converted to a dataset/datatable.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Da********@nospam.nospam> wrote in message
news:C6**********************************@microsof t.com...
Nicholas,
Great question!

You are right, not all formats can be "easily" translated to a DataSet.
The
CSV format is great because you can easily do this:

StreamReader srReadExcel = new
StreamReader((Stream)dataObject.GetData(DataFormat s.CommaSeparatedValue));

To clarify, I am looking for advice on how i can "check" if whats on the
clipboard is in a format one could create a dataTable from. I am not
necessarily looking for code but perhaps just a conversation on approach.

In a perfect world, perhaps someone has some assumptive code about a
particular format that allows them to make a datatable from it. Anyone?

Thanks!!!!
Dan
"Nicholas Paldino [.NET/C# MVP]" wrote:
Dan,

You are going to have to be a little more specific.

For example, if you do a file drop, text, or unicode text, is it
assumed
that the file, or the string in the text is the XML that represents the
data
set? Or is it just a random file, random strings? If it is the latter,
then you can not create a data set, since those things don't have the
structure necessary for one.

The same goes for HTML. How does one map HTML to a dataset? There
isn't anything that does this by default.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Da********@nospam.nospam> wrote in message
news:9F**********************************@microsof t.com...
>I want to make a class that basically looks at the clipboard, and for
>the
> standard types of clipboard objects (csv,text, etc), create a DataTable
> from
> it. Not all formats will be supported but as many as possible. The
> idea
> is
> to be able to convert the clipboard into a DataTable, and then pass the
> DataTable to another class to do some work on it.
>
> I have started the class here:
> http://www.theoren.com/DanH/ClipBoardDataTable.cs
>
> Right now, it only supports the DataFormats.CommaSeparatedValue which
> is
> great for Excel.
>
> The work I have done so far is a port of the vb.net project found here:
> http://www.codeguru.com/vb/controls/...cle.php/c6393/
>
> I am looking for some advice or examples that show how to convert the
> following DataFormats into a DataTable or DataSet
>
> FileDrop
> Html
> Text
> UnicodeText
>
> Perhaps this code would be useful to others as well so if i can support
> a
> couple more DataFormats, I will share on CodeProject.com or similar.
>
> Thanks,
> Dan
>


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
4
by: Kevin Brown | last post by:
I simply want to copy the DataView and paste it into an email. What's the best way to accomplish that? I could obviously write the XML to a string and copy the string, but that's "ugly" for an...
0
by: DapperDanH | last post by:
I want to make a class that basically looks at the clipboard, and for the standard types of clipboard objects (csv,text, etc), create a DataTable from it. Not all formats will be supported but as...
0
by: ngreplies | last post by:
I have a datagrid which is displayed on the screen in a grid. I would like to be able to perform an operation where the first five columns of data in the grid are copied to the clipboard (for all...
1
by: Robert Bravery | last post by:
Hi all, I'm using the following code to copy data from XL to the clipboard to be later usied in a datatable range = objSheet.get_Range("A22", "aa100"); range.Copy(Missing.Value).ToString();...
0
by: MathewJose | last post by:
Hi, I have a DatagridView in windows form.It has got a column which has some names that are populated from master table in database.Now i need to copy a set of data against these names. I...
0
by: Tom | last post by:
What is the best way to cut/copy an internal object to the clipboard and then paste it back in? For instance, I have an internal DataTable that I want to put on the clipboard, and then later on...
0
by: Tom | last post by:
I have some data in a DataTable, including a column of RTF (Rich Text Format) data. I wanted to be able to create a comma or tab-delimited string which I could then put on the clipboard, and then...
0
nirmalsingh
by: nirmalsingh | last post by:
hi all, i am using datatable and dataset to assign data into datagridview. now i want to print data of datagridview contents. i used a method to copy datagridview content in a clipboard and to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.