Hi
I use VB.net 2010
I have a form with a datagrid. Everytime I call this form, I send a parameter of Datamember, and DataSource to ther datagrid, so I populate it with data.
I want to be able to do a double click on a cell on the datagrid, and it will call a form.
The new form has properties on it. Here is an example a form:
Code:
Public Class bgUnitsi
Inherits bgCldFrm
Implements AmiDorGL.glGFuncs.ICommandEnterQry
Implements AmiDorGL.glGFuncs.ICommandExecQry
Implements AmiDorGL.glGFuncs.ICommandNew
Implements AmiDorGL.glGFuncs.ICommandSave
Implements AmiDorGL.glGFuncs.ICommandDelete
Private clsbgUnitsOra As New bgUnitsi_Ora
Private clsbgUnitsSQL As New bgUnitsi_SQL
Dim _iCatalogId As Integer
Dim _stUnitId As String
Public Property CatalogId() As Integer
Get
Return _iCatalogId
End Get
Set(ByVal Value As Integer)
txtCatalogId.Text = Value
End Set
End Property
Public Property UnitId() As String
Get
Return _stUnitId
End Get
Set(ByVal Value As String)
stUnitId = Value
End Set
End Property
If I use a direct call to it, it works great. Here is an example:
Code:
objFrmName = GetFormByName("bgUnitsi")
objFrmName.CatalogId = dgResults(dgResults.CurrentCell.RowNumber, 12)
objFrmName.UnitId= dgResults(dgResults.CurrentCell.RowNumber, _
dgResults.CurrentCell.ColumnNumber)
DrillToChildClass(objFrmName)
I want to use a dynamic call for form property (so I can send the form name, property name and the values is should have in one place)
This is the code I used, but it not work:
This is the sub:
Code:
Sub OpenChildForm(ByRef stChildForm As String, ByRef stParamString As String, _
ByRef iTotalParts As Integer)
Dim fFrmName As New Object
Dim stParamGeneral As String
'Dim iIndex As Integer
Dim stParamName(iTotalParts) As String
Dim stParam(iTotalParts) As String
Try
fFrmName = LocalGetFormByName(stChildForm)
For iPart As Integer = 1 To iTotalParts
stParamGeneral = AmiDorGL.glGFuncs.SplitString(stParamString, "|", _
iTotalParts, iPart)
'iIndex = AmiDorGL.glGFuncs.SplitString(stParamGeneral, "#", 2, 1)
stParamName(iPart) = AmiDorGL.glGFuncs.SplitString(stParamGeneral, "#", 2, 1)
stParam(iPart) = AmiDorGL.glGFuncs.SplitString(stParamGeneral, "#", 2, 2)
fFrmName.stParamName(iPart) = stParam(iPart)
Next
'Parameters
DrillToChildClass(fFrmName)
Catch ex As Exception
HandleExceptions(ex)
End Try
End Sub
and this is the call to the sub:
Code:
bgQuryVw.OpenChildForm("bgUnitsi", "CatalogId#1|UnitId#1", 2)
If I ceck on debug mode, I see that the parameters stParamName(iPart) and stParam(iTotalParts) get the correct values. The error rise on the next statement : fFrmName.stParamName(iPart) = stParam(iPart) and say "Public member 'stParamName' on type 'bgUnitsi' not found."
What I do wrong?
Thanks