Databases Reference
In-Depth Information
C#
private ParameterValue[] GetParameters()
{
ArrayList controls = new ArrayList();
//get the values from the parameter controls
int len = grpParamInfo.Controls.Count;
for(int i=0;i<len;i++)
{
if(grpParamInfo.Controls[i] is TextBox)
{
controls.Add(grpParamInfo.Controls[i]);
}
}
//add the control information to parameter info objects
len = controls.Count;
ParameterValue[] returnValues = new ParameterValue[len];
for(int i=0;i<len;i++)
{
returnValues[i] = new ParameterValue();
returnValues[i].Name = ((TextBox)controls[i]).Name;
returnValues[i].Value = ((TextBox)controls[i]).Text;
}
return returnValues;
}
VB
Private Function GetParameters() As ParameterValue()
Dim controls As New ArrayList
'get the values from the parameter controls
Dim len As Integer = grpParamInfo.Controls.Count
Dim i As Integer
For i = 0 To len - 1
If TypeOf grpParamInfo.Controls(i) Is TextBox Then
controls.Add(grpParamInfo.Controls(i))
End If
Next i
'add the control information to parameter info objects
len = controls.Count - 1
Dim returnValues(len) As ParameterValue
For i = 0 To len
returnValues(i) = New ParameterValue
returnValues(i).Name = CType(controls(i), TextBox).Name
returnValues(i).Value = CType(controls(i), TextBox).Text
Next i
Return returnValues
End Function
Search WWH ::




Custom Search