Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - Type control mismatch
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Type control mismatch

 Post Reply Post Reply
Author
Message
denny.holl@yahoo.com View Drop Down
Newbie
Newbie
Avatar

Joined: 26 September 2012
Location: Indonesia
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote denny.holl@yahoo.com Quote  Post ReplyReply Direct Link To This Post Topic: Type control mismatch
    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.
Back to Top
justzain View Drop Down
Newbie
Newbie


Joined: 07 May 2012
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote justzain Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.