Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: datarow problem

0
0
Hi I must be missing something.
What is wrong with my code

vb.net
Dim engine As New V8ScriptEngine(V8ScriptEngineFlags.EnableDebugging)
engine.AddHostType("Console", GetType(Console))
engine.AddHostType("MessageBox", GetType(MessageBox))
engine.AddHostObject("myRow", ExcelFileDataSet.Tables(0).Rows(0))
Dim jsScript As String = txttest.Text
Try
            engine.Execute(jsScript)
            engine.Script.test
Catch ex As Exception
            MessageBox.Show(ex.Message)
End Try
javascript
function test() {
  MessageBox.Show('a');
  MessageBox.Show(myRow[0].ToString);
}
It first shows me the messagebox with 'a' and afterwards gives me an error
TypeError : Cannot read property 'ToString' of undefined

Viewing all articles
Browse latest Browse all 2297