Forum Discussion
Photo_G_84660
Nimbostratus
Sep 05, 2006VB .NET nodeDisable sub
Hi,
I am trying to code a disableNode sub-procedure in VB .NET, and I am getting this error:
"Value of type 'App_Based_Node_Handler.NodeAddress.CommonEnabledState' cannot be converted to '1-dimensional array of App_Based_Node_Handler.NodeAddress.CommonEnabledState'."
Here is the sub:
Sub disableNode()
Dim sNodeAddress = txtNodetoDisable.Text
Dim state As NodeAddress.CommonEnabledState
state = App_Based_Node_Handler.NodeAddress.CommonEnabledState.STATE_DISABLED
Dim configure = Node.set_session_enabled_state(sNodeAddress, state)
Along with the error, the compiler highlights the 'state' variable at the end of the last line, and I cannot seem to figure out what I am doing wrong.
Can anyone clarify this error for me?
Thanks in advance,
Scott H.
5 Replies
- The signature for LocalLB::Node::set_session_enabled_state() is as follows:
void set_session_enabled_state( in String[] node_addresses, in EnabledState[] states );
The parameters are arrays and you are passing in scalars. The error is correct, the compiler cannot convert a scalar without your help.
My VB is a bit rusty so I don't have the syntax off hand. It should be something like this:Dim node_addressess() as String = {sNodeAddress} Dim states() as NodeAdddress.CommonEnabledState = {state} Dim configure = Node.set_session_enabled_state(node_addresses, states)
-Joe - Photo_G_84660
Nimbostratus
Thanks Joe,
I tweaked the CommonEnabledStates statement and changed it to a function, and I think I am real close. For some reason though, the 'configure' expression does not produce a value. I'm still missing the boat here...Public Function disableNode() Dim node_addresses() As String = {sNodeAddress} Dim states() As NodeAddress.CommonEnabledState = _ {App_Based_Node_Handler.NodeAddress.CommonEnabledState.STATE_DISABLED} Dim configure = Node.set_session_enabled_state(node_addresses, states) End Function
...and MSDN is not much help at all: Expression does not produce a value
You have tried to use an expression that does not produce a value in a value-producing context, such as calling a Sub in a context where a Function is expected.
Error ID: BC30491
To correct this error
Change the expression to one that produces a value.
Thanks in advance for any pointers that you can think of...
Scott H. - Not sure why you have the "Dim configure =" part of the line as the method doesn't return a value. Just remove it...
Public Function disableNode() Dim node_addresses() As String = {sNodeAddress} Dim states() As NodeAddress.CommonEnabledState = _ {App_Based_Node_Handler.NodeAddress.CommonEnabledState.STATE_DISABLED} Node.set_session_enabled_state(node_addresses, states) End Function
-Joe - Photo_G_84660
Nimbostratus
Got it. Thanks a million Joe! - Katherine_G_106
Nimbostratus
Thanks for the snippets, this just made my day!
-K
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
