473,587 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1715
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.GetDa taObject()

' Determines whether the data is in a format you can use.
If data.GetDataPre sent(DataFormat s.Text) Then
' create an arraylist
' split comma-delimited items
Dim s As String = CType(data.GetD ata(DataFormats .Text), String)
Dim ar() As String = s.Split(","c)
Me.ListBox1.Ite ms.Clear()
Me.ListBox1.Ite ms.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******** ******@TK2MSFTN GP15.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.Te xt

serverarray = userdata.Split( vbCrLf)

Console.WriteLi ne(serverarray( 2))

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



"Russell Jones" <ar**@nospam.no rthstate.net> wrote in message
news:ul******** ******@TK2MSFTN GP15.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.GetDa taObject()

' Determines whether the data is in a format you can use.
If data.GetDataPre sent(DataFormat s.Text) Then
' create an arraylist
' split comma-delimited items
Dim s As String = CType(data.GetD ata(DataFormats .Text), String)
Dim ar() As String = s.Split(","c)
Me.ListBox1.Ite ms.Clear()
Me.ListBox1.Ite ms.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******** ******@TK2MSFTN GP15.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
3329
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 the list box (items they wish inserted into the table), or they can select items in the list box to delete (from the table). Once they have finished making any changes, they are to click a SAVE button to actually commit the changes to the database....
3
2873
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 application or notepad where i want to paste it to be.How can i do it?If anyone knows source code or any website URL's please let me know. Umasakshi
1
3378
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 be able to copy the item in the cell of list control and paste it into any cell. this should also make proper changes to the linked list too.
2
2202
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 a Not-in-list-error. But sometimes we also get this error when pasting items which are part of the list. Sometimes, not allways. It is not comprehensible for me what's different for the strings where it works.
6
9638
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 adds Cut copy and paste commands, this functionality no longer works. It seems now I need to implement handlers for these functions. I tried to do so, but say the paste handler, I need to call paste on a specific control and that isn't necessarily...
3
2021
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 instance and I'm having trouble with the syntax, can someone please help me? thanks, rodchar
7
15640
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
5
2684
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 running this in IE, behaviour is as I would expect it. If I select an item and do a postback, the page remembers my selection when reloading, and the SelectedIndex property of my control returns the correct value.
2
14753
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 the DataError event and just doing nothing in the circumstance that caused the error. Here's my situation: I would like to allow the user to EITHER select an item from the ComboBox (in a DataGridView) OR type in a new value of their own.
0
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
5722
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.