473,800 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help required for: Copy / Paste command

Im trying to build a calculator for an assignment! (due wednesday)

im having trouble finding any code for creating Copy/Paste menu
buttons (just need the "doing" code)

can anyone help?

in addition, how do you get the keyboard numbers to activate the
"calculator " buttons. (not as important)

thanks for any info provided.

Max

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 21 '05 #1
2 1565
Siv
Max,
This is my routine, which I got from this group many Moons ago:

' =============== =============== =============== ========

Function CutCopyPaste(By Val type As Integer, ByVal ctrl As Control) As
String

'Type is 1=Cut 2=Copy 3=Paste

'ctrl is control being cut or copied from or if type=3 is the control being
pasted to.

Select Case type

Case 1 '=Cut

Try

Clipboard.SetDa taObject(ctrl.T ext)

ctrl.Text = "" 'THEN clear the source control

Catch ex As Exception

Call ProgErrorHandle r("CutCopyPas te - Cut", "Common Module", ex.Message,
False)

End Try

Case 2 '=Copy

Try

Clipboard.SetDa taObject(ctrl.T ext)

Catch ex As Exception

Call ProgErrorHandle r("CutCopyPas te - Copy", "Common Module", ex.Message,
False)

End Try

Case 3 '=Paste

Try

Catch ex As Exception

Dim objClipboard As IDataObject = Clipboard.GetDa taObject()

With objClipboard

If .GetDataPresent (DataFormats.Te xt) Then

ctrl.Text = .GetData(DataFo rmats.Text)

End If

End With

End Try

End Select

End Function

' =============== =============== =============== ========

"Max81" <ma******@yamo. org-dot-uk.no-spam.invalid> wrote in message
news:41******** **@Usenet.com.. .
Im trying to build a calculator for an assignment! (due wednesday)

im having trouble finding any code for creating Copy/Paste menu
buttons (just need the "doing" code)

can anyone help?

in addition, how do you get the keyboard numbers to activate the
"calculator " buttons. (not as important)

thanks for any info provided.

Max

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 21 '05 #2
Siv
Max,

Please note that the call to ProgErrorhandle r is just a generic routine that
I use to display a message about the error that occurs:
Public Sub ProgErrorHandle r(ByVal FuncOrSubName As String, ByVal FormName As
String, ByVal ErrMessage As String, Optional ByVal CloseApplicatio n As
Boolean = False)

'This is the routine that is passed error details for display to the
user and which will shut down the application if the error is sufficiently

'Serious as denoted by the "CloseApplicati on" parameter, can be left and
False assumed

Dim Msg As String

Msg = "An error has occurred in the " & FuncOrSubName & " procedure in
the " & FormName & " form." & vbCrLf & vbCrLf

Msg += "The error message returned is:" & vbCrLf & vbCrLf & ErrMessage &
vbCrLf & vbCrLf

Select Case CloseApplicatio n

Case False

Msg += "This error is not too serious to continue, but the
information from this dialog should be reported to " & Support

Msg += ". If this error occurred whilst making changes to the
database, it is likely that your data has not been saved. "

Case True

Msg += "This error is too serious to continue running the
application, any outstanding changes will be lost. Please make a note "

Msg += "of the message details above and pass them to " & Support &
" so that the cause of this error can be rectified in a "

Msg += "future release of this application. I apologise for this
problem and will endeavour to fix it as soon as possible "

Msg += "once I know where the error lies."

MsgBox(Msg, MsgBoxStyle.Inf ormation, H)

Call EndApplication( )

End Select

Dim Resp As Integer = MsgBox(Msg, MsgBoxStyle.Inf ormation, H)

End Sub

The variable "Support" just holds the relevant support desk name and number.
The EndApplication routine is just used to close down any global variables
and shut down forms etc

Hope they are useful.

Siv

"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:%2******** **********@TK2M SFTNGP14.phx.gb l...
Max,
This is my routine, which I got from this group many Moons ago:

' =============== =============== =============== ========

Function CutCopyPaste(By Val type As Integer, ByVal ctrl As Control) As
String

'Type is 1=Cut 2=Copy 3=Paste

'ctrl is control being cut or copied from or if type=3 is the control
being pasted to.

Select Case type

Case 1 '=Cut

Try

Clipboard.SetDa taObject(ctrl.T ext)

ctrl.Text = "" 'THEN clear the source control

Catch ex As Exception

Call ProgErrorHandle r("CutCopyPas te - Cut", "Common Module", ex.Message,
False)

End Try

Case 2 '=Copy

Try

Clipboard.SetDa taObject(ctrl.T ext)

Catch ex As Exception

Call ProgErrorHandle r("CutCopyPas te - Copy", "Common Module", ex.Message,
False)

End Try

Case 3 '=Paste

Try

Catch ex As Exception

Dim objClipboard As IDataObject = Clipboard.GetDa taObject()

With objClipboard

If .GetDataPresent (DataFormats.Te xt) Then

ctrl.Text = .GetData(DataFo rmats.Text)

End If

End With

End Try

End Select

End Function

' =============== =============== =============== ========

"Max81" <ma******@yamo. org-dot-uk.no-spam.invalid> wrote in message
news:41******** **@Usenet.com.. .
Im trying to build a calculator for an assignment! (due wednesday)

im having trouble finding any code for creating Copy/Paste menu
buttons (just need the "doing" code)

can anyone help?

in addition, how do you get the keyboard numbers to activate the
"calculator " buttons. (not as important)

thanks for any info provided.

Max

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*


Nov 21 '05 #3

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

Similar topics

77
5696
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a database from SQL Server to Oracle or DB2 or vice versa... and that's it.... And a lot of these enterprises don't need it as they already know what database they are going to use and they don't plan on switching in and out database in the first...
5
1794
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to start fresh after the .jpg section of the move images code. this will be essential to make the whole thing work. Please help. Even if you just write out the solution. I am beggin. I am desperate. Please help. <!DOCTYPE HTML PUBLIC...
3
3427
by: radioman | last post by:
Hi all, I would appreciate some help please. I just need pointing in the right direction as I am at a loss. Basically I have a form (frmAddMaster) which displays two subforms "Master Stock subform" and "Client Stock Template subform". Each subform contains the following fields "Product ID,Product Description and Size". What I am trying to do is to select rows from the "Master Stock subform" and copy them to "Client Stock Template...
38
2560
by: Red Dragon | last post by:
I am self study C student. I got stuck in the program below on quadratic equation and will be most grateful if someone could help me to unravel the mystery. Why does the computer refuse to execute my scanf ("%c",&q); On input 3 4 1 (for a,b and c) I had real roots OK On input 1 8 16 I had same real roots OK. However on 4 2 5, (for imaginary roots ) the computer cannot see the scanf ("%c",&q); statement. It just jumps...
5
1355
by: roopeman | last post by:
i wrote the below code , just want got local machine application Eventlog 's message , and write to MDB.but it 's can not write the message to Mdb, somebody can check it for me? thanks! //----------------------------------------------------------------------- //Wrote by Michael April 30 2005 //----------------------------------------------------------------------- using System.Text;
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
232
13362
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
2
9327
by: nelsonbrodyk | last post by:
Hey All, I am trying to implement buttons that follow the command pattern. .NET exposes ApplicationCommands.Cut, copy and paste. I am trying the following: <Button Command="ApplicationCommands.Copy"/> //also have paste and cut. <TextBox Width="50"/> In the designer, selecting the textbox will eneable cut/copy. However when I run the application and go into the textbox and type, non the the buttons enable. Is this some sort of a...
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10251
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
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
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2945
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.