Results 1 to 6 of 6

Thread: pasting into a textbox

  1. #1
    Guest
    I am using a calculator program and have a Paste button so that I can paste the readout or answer into a textbox on another form. In other words, I use a form (Form1) with a textbox (Text1) and I want to be able to call up the calculator form, run a calculation and then paste the result into the Form1.Text1 textbox. I have several textboxes on Form1, so I need to make sure that I paste the result into the right textbox.

    I want to paste in in the textbox that has the focus. I can't figure out how to tell the Calculator Paste command button how to identify the textbox that has the focus on Form1.

    Any help? Thanks.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Somewhat confused on this one. If you are sending text to a textbox you must know where you are sending it. If you call form2(Calc) and do your cal why can't your just say.
    form2.textWhatever.text = form1.text1.text
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    Maybe I am missing something so easy:

    When I call up the Calculator form and calculate the numbers (e.g., 7 + 8 =15) and I click the Paste command button on the Calculator form, how does the Calculator form know which textbox on Form1 to put "15" in?

    Form1 has a number of textboxes in a control array ranging from Text1(0) to Text1(15).

    How does the Calculator Paste button know to put the answer "15" in Form1.Text1(6), for example.

    Thanks.

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I was missing something...thought you were using your own calculator program not Calc...
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Can you use this as a walk around?
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    'here I shell calc and do my calculation and copy
    Shell "c:\windows\calc.exe"
    'Close calc
    
    End Sub
    
    
    Private Sub Command2_Click()
    'here I tell text1 to get the clipboard (copied calculation)
      Text1.Text = Clipboard.GetText(vbCFText)   ' Get Clipboard text.
      
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    Guest
    I thought about that, but there I am coding each individual textbox on Form1 for that.

    I have written the program where a user can double click (DblClick Event) on any textbox (there are about 15, ranging from Text1(0) to Text1(14)). The calculator is then called up. I am using the Calculator project/form that came with VB6, except I added a command button captioned "Paste."

    I want my application to remember which textbox (e.g., text1(6)) was double clicked, so that when I click Paste, the readout of the Calculator is pasted into the textbox that I double clicked.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width