Solved

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

Posted on 2004-08-05
4
149 Views
Last Modified: 2010-05-02
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
Comment
Question by:DrDamnit
  • 2
4 Comments
 
LVL 5

Expert Comment

by:millsoft
ID: 11730876
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
 
LVL 5

Expert Comment

by:millsoft
ID: 11730884
DrDamnit,
When it doesn't paste correctly, what does happen?  Does the text go into the wrong field, or just disappear?
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 11731143
0
 
LVL 9

Expert Comment

by:s_sansanwal
ID: 11732427
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 39
MS Access Search and Replace Using VBA 6 69
Determine Range to Select 5 48
Add and format columns in vb6 7 56
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question