Summary
Poking data into ArcView from Visual Basic (ArcView as a source) is an easy way to execute a script and pass the value of the Visual Basic control as the SELF object to the script.
Procedure
For example, if you want to pass a comma-delimited list from Visual Basic to ArcView, use the following code in Visual Basic. This example shows how you can use a Visual Basic form to set some parameters and pass those parameters as arguments to an Avenue script.
- Create a form in Visual Basic with a CommandButton and a TextBox.
- Change the name of the TextBox to txtData.
- Add the following code to the click event of the CommandButton:
Code:
txtData.LinkMode = 0
txtData.LinkTopic = "ArcView|System"
txtData.LinkMode = 2
txtData.LinkTimeout = 600
txtData.Text = "item1,item2,item3"
txtData.LinkItem = "String Script1"
txtData.LinkPoke
txtData.LinkMode = 0
The components of txtData.LinkItem are a keyword "string" that indicates the data type followed by the name of the script to run, in this case, Script1. - Open ArcView and a new Script window.
- Copy and paste the following code into the Script window:
Code:
theItems = Self.AsTokens(",")
MsgBox.ListAsString(theItems, "Poke Test", "Test")
- Click the Compile button.
![[O-Image] Script compile button](https://webapps-cdn.esri.com/CDN/support-site/technical-articles-images/000004016/00N39000003LL2C-0EM39000000wcaJ.png)
- Run the Visual Basic form.