Question Refresh winform window commands

Joe1

Active member
Joined
Dec 4, 2012
Messages
37
Programming Experience
Beginner
Hello,

I have a winform with a button, that when clicked performs a number of commands and displays the results in a new window. I am looking to add a refresh button/timer on to the second form. So that the page can be refreshed/commands be resent directly from there.

The code of the commands I send, and am trying to refresh is below, but when run i receieve an unhandled excpetion error.


ForEach row AsDataGridViewRowIn DataGridViewView.Rows

Dim response1 AsObject = Nothing

m_plugin_services.DoCommandEx(m_token, _
"print ${" & row.Cells(2).Value & "}", response1)


Dim value1 AsObject = response1.ToString()

value1 = value1.Substring(0, value1.IndexOf(vbCr))

DataGridViewView.Rows.Add(
"joe1", value1, row.Cells(2).Value)
Next

What would be the best way to perform the refresh, and how would i do this?
 
I can't specifically say where exactly the error is being thrown as i am running as a plugin in another program. However I have tried using a message box below the 'response' and 'value' variables to output an message if a zero value occurs at either point, which should not exist. The error message being thrown is "Object reference not set to an instance of an object"
 
If I had to guess, which I do, I'd say that 'response1' is coming back from DoCommandEx with no value, so calling ToString on it fails.

By the way, what's the point of calling ToString and then assigning the result to an Object variable? If it's a String then surely the variable should be type String.
 
Back
Top