LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling Text box copy option

Hello,

 

I need some help on enabling Text Box copy. I dump some data in the text box and I need to enable select and copy for the user. I could not find anything the discussion forum. Please help!

 

Thanks in advance!

 

Sandeep.

0 Kudos
Message 1 of 4
(3,818 Views)

Hi Sandeep,

 

There are a few different ways to go about doing this depending on the exact behavior you desire.  

 

If you are looking for the user to be able to select, copy, and paste text then I would suggest taking a look at the following links:

How to: Select Text in the Windows Forms TextBox Control

Cut, Copy, Paste and Undo in VB .NET

 

The first link explains how to select text based on a user's action - in this case, when the textbox initially gains focus.  The second link will then explain how you can similarly create copy/paste functionality for the user from a button or other source.

 

The above shows how you would accomplish a copy if you wanted the user to be able to copy at runtime.  However, if you are looking to programmatically take the text in your textBox and copy it into another field, you can do this using the following code:

textBox1.Text = "Test";           

string test = textBox1.Text;


The first line is setting the text value and the second line is taking the value and putting it into the string 'test'.

 

I hope this helps, good luck on your project!

 

Regards,

Trey C.

 

0 Kudos
Message 2 of 4
(3,804 Views)

Thanks Trey. I was looking for some library function in CVI to enable or disable the copy command. I dont think CVI has one.

Thanks anyways.

 

0 Kudos
Message 3 of 4
(3,800 Views)

Sandeep,

 

I'm sorry, apparently I was really focused on .net, I didn't realize you were working in CVI!  This may not be a built in functionality but you can still replicate the behavior by using GetCtrlValue, SetCtrlValue, or ClipboardGetText and ClipboardSetText.  If you are just looking for standard copy/paste functionality as you would use in any other program, this should work without additional coding on your part.  So the user could use Ctrl+C & Ctrl+V to copy text. 

 

Regards, 

Trey C.

0 Kudos
Message 4 of 4
(3,796 Views)