473,414 Members | 1,667 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,414 software developers and data experts.

ALlow user to paste list of items into form

I'm not sure which control to use for this:

I would like the user to be able to paste a list of items into a box and
then be able to run through them one at a time. Hopefully there is a
control that would place them into an array. I don't want the user to put
them in one at a time..

Thanks..

Nov 21 '05 #1
2 1704
There isn't, that I know of, but you can easily write what you want. For
example, here's the code to let users paste a comma-delimited set of items
into a ListBox, where the user can then select them individually.

Dim data As IDataObject = Clipboard.GetDataObject()

' Determines whether the data is in a format you can use.
If data.GetDataPresent(DataFormats.Text) Then
' create an arraylist
' split comma-delimited items
Dim s As String = CType(data.GetData(DataFormats.Text), String)
Dim ar() As String = s.Split(","c)
Me.ListBox1.Items.Clear()
Me.ListBox1.Items.AddRange(ar)
Else
' No it is not.
MessageBox.Show("Could not retrieve data off the clipboard.")
End If

Obviously, you'd need to change the code and (sometimes) the target control
to paste other things, such as images, or a set of selected filenames.
"Microsoft" <ma*@mas.com> wrote in message
news:O9**************@TK2MSFTNGP15.phx.gbl...
I'm not sure which control to use for this:

I would like the user to be able to paste a list of items into a box and
then be able to run through them one at a time. Hopefully there is a
control that would place them into an array. I don't want the user to put
them in one at a time..

Thanks..

Nov 21 '05 #2
OK.. I was able to get the results and get it into an array but I can;t
fiugure out the delimiter to use so that each line equals 1 array element

In the debug the data looks like it has one or two little squares betwwen
each value, but the data is in the Richtextbox like this

server1
server2
server3

Here is my code.. I can't get the delimiter right. It all ends up in
Serverarray(0)

Dim userdata As String

Dim serverarray As String()

Dim servercount As Integer

userdata = RichTextBox1.Text

serverarray = userdata.Split(vbCrLf)

Console.WriteLine(serverarray(2))

I get array out of bound because serverarray(0) is the entire textbox



"Russell Jones" <ar**@nospam.northstate.net> wrote in message
news:ul**************@TK2MSFTNGP15.phx.gbl...
There isn't, that I know of, but you can easily write what you want. For
example, here's the code to let users paste a comma-delimited set of items
into a ListBox, where the user can then select them individually.

Dim data As IDataObject = Clipboard.GetDataObject()

' Determines whether the data is in a format you can use.
If data.GetDataPresent(DataFormats.Text) Then
' create an arraylist
' split comma-delimited items
Dim s As String = CType(data.GetData(DataFormats.Text), String)
Dim ar() As String = s.Split(","c)
Me.ListBox1.Items.Clear()
Me.ListBox1.Items.AddRange(ar)
Else
' No it is not.
MessageBox.Show("Could not retrieve data off the clipboard.")
End If

Obviously, you'd need to change the code and (sometimes) the target control to paste other things, such as images, or a set of selected filenames.
"Microsoft" <ma*@mas.com> wrote in message
news:O9**************@TK2MSFTNGP15.phx.gbl...
I'm not sure which control to use for this:

I would like the user to be able to paste a list of items into a box and
then be able to run through them one at a time. Hopefully there is a
control that would place them into an array. I don't want the user to put them in one at a time..

Thanks..


Nov 21 '05 #3

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

Similar topics

1
by: Ryan | last post by:
Hello, I have a quick question (I hope). I have a form with a combo box and a multi-selection list box. The list box is based on a query. Users can select values from the cmbobox to add to...
3
by: Uma sakshi | last post by:
Hi I have one VB.NET application,in that application i have one datagrid control.The datagrid control contains somedata.I want to copy the data in a particular cell and paste it into my C#.NET...
1
by: raniyesudas | last post by:
In our project we have to use pop up menu to cut,copy,paste items to linked list. the items of the list are displayed in the list control.Hence by clicking on the item in the list control we should...
2
by: steph | last post by:
Hi, Access 2002: We've got a DataSheet-Form with a Combobox-field that shows strange behaviour. The ComboBox is constrained to the list so if we paste a value not existing in the list we get...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, I have web user control (c# code-behind) and i'm trying to create a property that will provide the user with a drop down list of values inside the property box for that web user control...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hallo, I have a radiobuttonlist control that is added on a custom Web User Control. This control has a property that exposes the SelectedIndex property of the embedded radiobuttonlist. When...
2
by: =?Utf-8?B?RHJEQkY=?= | last post by:
I understand that the Value put into a DataGridViewComboBoxCell has to be a member of the Items list or an exception is thrown. I also understand that you can override that exception by handling...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.