Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing ComboBox as Parameter

Status
Not open for further replies.

ufobaby

MIS
Sep 25, 2001
238
US
hi,
am developing a DLL. the following is the function
-------------------------------------------
Code:
Function FillValues(ByRef objControl As Object, _
ByVal objRecordset As Object, ByVal FieldNumber As Integer, _
ByVal Append As Boolean)

'=================================================================
'Parameteres -
' 1. objControl     - ComboBox or a ListBox control
' 2. objRecordset   - Valid Recordset Object
' 3. FieldNumber    - FieldNumber from the Recordset
' 4. Append         - if TRUE  - Appends to the existing values in the Control
'                     if FALSE - Clears the Control and add the new values
'
'Returns  - Creates a file in the path specified by TextStream
'=================================================================

On Error GoTo FillValuesErr:

If objRecordset.RecordCount <> 0 Then
  objRecordset.MoveFirst
  If Append = False Then
   objControl.Clear
  End If
  
  Do While objRecordset.EOF = False
    objControl.AddItem objRecordset(FieldNumber) & &quot;&quot;
  objRecordset.Movenext
  DoEvents
  Loop
End If

Exit Function
--------------------------------------------------
what needs to be done is the first parameter should accept a ComboBox or a Listbox and populate the same accordingly.

when in my form i call this function
Code:
objofmydll.FillValues Combo1,objRs, 0, False

it says &quot;Object Variable or With block ......&quot;

what is the solution i tried the Parameter &quot;as ComboBox&quot; but it does not compile , says Private Objects cannot be set as parameters.

pls help...

__________
[cheers]
Niraj...
&quot;The unexpected success is not just an opportunity for innovation. It demands innovation.&quot;
[noevil]
 
I'm not sure the problem is in the DLL. Have you properly created an instance of the DLL (objofmydll) in the program, is Combo1 the correct name of the ComboBox, and it is known to the calling function, and has objRs been propertly instantiated?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
hi, thx for that
i guess some problem with registering the dll. i re-registered it and now it works fine ....
sorry for the trouble.

__________
[cheers]
Niraj...
&quot;The unexpected success is not just an opportunity for innovation. It demands innovation.&quot;
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top