Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi, I haven't been using MathCad 15 very much and am relatively new to coding.
I'm having trouble using VBscript to get my List Box to do what I want it to do
In my MathCad file I've created a Matrix. I then created an array that holds the first column of the matrix. I want to feed that array into the ListBox to populate the List and then return the index of the selection from the listbox.
I can't seem to get the ListBox to populate with the Array. I'm using ListBox.AddString () and keep getting the error "Type mismatch: 'ListBox.AddString'"
I'm not able to use the Array as I'd hoped
Please provide guidance, resources or tips
Thanks
Solved! Go to Solution.
Hi
The documentation for the scripting language is not too helpful, the attached is a mix of items that I found on the forums and a little from trial & error.
The listbox that you scripted had a few issues.
Mainly that if you need to give it parameters, then the only place that I have seen to access the data is in the EXEC function not the START as you might expect.
the example has been modified to get it basically working, & has various changes in {ListBox Control} > properties to give scrollbars etc to ease the selection process.
It isn't a good example yet as it has at least one major flaw...
every time you access the control, it appends another complete set of your list at the end of the List box - it just keeps growing.
It doesn't allow for the control to 'remember' the selected state - so it needs to be set everytime the Mathcad sheet is opened.
I hope that this will get you started & no doubt will raise many more questions.
Regards
Andy
Hi
The documentation for the scripting language is not too helpful, the attached is a mix of items that I found on the forums and a little from trial & error.
The listbox that you scripted had a few issues.
Mainly that if you need to give it parameters, then the only place that I have seen to access the data is in the EXEC function not the START as you might expect.
the example has been modified to get it basically working, & has various changes in {ListBox Control} > properties to give scrollbars etc to ease the selection process.
It isn't a good example yet as it has at least one major flaw...
every time you access the control, it appends another complete set of your list at the end of the List box - it just keeps growing.
It doesn't allow for the control to 'remember' the selected state - so it needs to be set everytime the Mathcad sheet is opened.
I hope that this will get you started & no doubt will raise many more questions.
Regards
Andy
Thank you for your response and comments.
Hello,
maybe this little code will help. BTY; there is a nice collection of codes and solutions called "Useful extra components" in this forum. Check for it, there may be more you maight find handy.
Raiko
Thank you for the code and referenced information.
Here is a link for "Extra Components and Controls" document: Extra Components and Controls
Thanks for posting the link