cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

MS Visual Studio 2005 transmit fails

TNO-HTH
4-Participant

MS Visual Studio 2005 transmit fails

Section Automation Example: Visual Basic Form
recommends a simple way to transmit parameter (of type string, floating point or interger) to a MathCad worksheet. This seems to fail in my Visual Basic

Parameter to be filled in with a value from a dataset in the VB application::
- Kolomhoogte := kolom


The essential excerptss are:
Class Form1
�.
Public AWS As Mathcad.Worksheet = Form1.WSS.Open(Form1.MathcadBestandTextBox.Text)
AWS.SetValue("kolom", RowMainWSL("KasdekKolomhoogte"))
�.

RowMainWSL is a row of a dataset, with a double precision field KasdekKolomhoogte

This call of the SetValuee mathod can be compiled and executed without difficulty, but no value seems to be transmitted.

After recalculation:
MathCadApplicatie. Recalculate
4 REPLIES 4
RichardJ
19-Tanzanite
(To:TNO-HTH)

Please don't cross post. Abandon the thread in the "Mathcad en Francais" forum. Even better, go and delete your post there, then I'll delete mine.

When you say that no value was transmitted, how do you know? If you send a scalar to "kolom", then the Mathcad sheet has kolom2:kolom*2, then you use GetValue to get the value in kolom2, do you get the correct number?

Richard
TNO-HTH
4-Participant
(To:TNO-HTH)

The Setvalue seems to work ok, but the Getvalue gives no results. We have tried different options with no success. I have searched in the forum for the same problem. It looks the same as the issue "Win32::OLE bridging Perl Thread Issues". For this problem no solution is found in the forum.
RichardJ
19-Tanzanite
(To:TNO-HTH)

TNO-HTH
4-Participant
(To:RichardJ)

Thanks for this info. It was helpfull to solve the problem:

It is important to assign the result of a GetValue function to a Value type of the namespace MathCad; NOT to a standard type in Visual Basic:

Dim MyOutputNum As Mathcad.Value = Form1.AWS.GetValue("aNumericalMathCadVariable")

Dim MyOutputstr As Mathcad.Value = Form1.AWS.GetValue("aStringVariableInMathCad")

Form1.TextBoxNokConclusie1.Text = MyOutputNum.AsString

Form1.TextBoxNokConclusie2.Text = MyOutputstr.AsString

(here is AWS a MathCad worksheet)

MathCad type Value works for all types returned by GetValue; the MathCad type INumerical and Numeric only for numers returned by GetValue;

The type of the returned result by GetValue is checked only at run time; the VB compiled cannot detect what sort of value is assigned to a variable in a MathCad document.

Hans
Top Tags