Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Passing a variable in one program to a text box in another

Some time ago, I wrote an application that calculates retail prices for an imported item after taxes, shipping, and all the other fees and crap that you have to go through to get something here from China.

I am now writing another program that will need the pricing that program A can render. I want to integrate the two. So far, I have a button on the new program which calls the retail price quoter via the ShellExecute function. I pass a series of command line arguments to have the quote load properly, and all that works fine.

The price I need is displayed in a label, which looks like this:

End User Retail Price: $19.99

I use the split function ($ delimeter) to separate out the 19.99 from the rest of it, and have that stored in a variable called sTemp(1). What I want to do is take the string that is in this array slot and put it in a text box of the new program.

Here's the code I tried, but it is not stable: sometimes it works, sometimes no:
Note: 'sJOWAppTitle is a string variable that stores the caption of the form to which I want to 'paste' the string.

    Dim sTemp() As String
    sTemp = Split(lblInfo(8).Caption, "$")
    AppActivate sJOWAppTitle,100
    SendKeys (sTemp(1))

Does anyone have a better idea?
0
DrDamnit
Asked:
DrDamnit
  • 2
1 Solution
 
millsoftCommented:
Hi DrDamnit,


How about modifying the old program so it puts the price you want on the clipboard and then have the new program read it off the clipboard?



Cheers!
Brad
0
 
millsoftCommented:
DrDamnit,
When it doesn't paste correctly, what does happen?  Does the text go into the wrong field, or just disappear?
0
 
s_sansanwalCommented:
Copy the functionality that is doing calculation in a DLL
Then, modify both application to use this dll
If you still wanted to use current senerio, look inot DDE (see MSDN)

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now