Print Page | Close Window

Type control mismatch

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=20160
Printed Date: 30 January 2025 at 9:15pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Type control mismatch
Posted By: denny.holl@yahoo.com
Subject: Type control mismatch
Date Posted: 26 September 2012 at 6:06am
I'm having difficulty when try to fill codejock combobox this way:


Public Function fillcombo(ByRef combo As ComboBox, strQuery As String, field As Integer) as boolean
  If conAdo.State = adStateOpen Then
    rstAdo.Open strQuery, conAdo
  End If
  If rstAdo.EOF = False Then
    rstAdo.MoveFirst
    combo.Clear
    Do
      combo.AddItem (rstAdo.Fields(field))
      rstAdo.MoveNext
    Loop Until rstAdo.EOF = True
  End If
End Function

When i call it for example:
fillcombo(combo1, "select * from something", 1)

It said:  13 Type mismatch

Is it something to do with the same type control of vb combobox ?


Any help would be appreciated.



Replies:
Posted By: justzain
Date Posted: 13 October 2012 at 4:00am

Try This Amended Code it works for you:-

Option Explicit
Dim ConAdo As ADODB.Connection
Dim RstAdo As ADODB.Recordset

Public Function FilCjCombo(ByRef CjCbo As XtremeSuiteControls.ComboBox, strQuery As String, field As Integer) As Boolean
Set RstAdo = New ADODB.Recordset
If ConAdo.state = adStateOpen Then
RstAdo.Open strQuery, ConAdo
End If
If RstAdo.EOF = False Then
RstAdo.MoveFirst
CjCbo.Clear
Do
CjCbo.AddItem (RstAdo.Fields(field))
RstAdo.MoveNext
Loop Until RstAdo.EOF = True
End If
End Function

Private Sub Form_Load()
Set ConAdo = New ADODB.Connection
ConAdo.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NWIND.MDB;Persist Security Info=False"
FilCjCombo ComboBox1, " Select * from Employees", 1
End Sub



Posted By: Xander75
Date Posted: 06 November 2012 at 4:41am
You are using "ByRef combo As ComboBox", which is why you are getting the Type Mismatch! It is expecting the VB.Combobox and you are passing the Codejock Combobox.

Instead use  the following: "ByRef combo As XtremeSuiteControls.ComboBox"

-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net