Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB6: How to create an Antview control dynamically?
#1
Hello, programmers!

I need to dynamically create Antview controls becose of function to open and close some number of web views with the tab-control.

I have try some code, but it give the error message only: Type mssmatch!

Code:
Public Function MakeTheAnt()
  Dim oCtrl As Object
  Dim oAntview As Antview
  'Or Dim oAntView As AntViewAx2.Antview
 
  Set oCtrl = Controls.Add("AntViewAx2.Antview", "oCtrl")
  Set oAntview = oCtrl.object '->Error: Type missmatch
 
  'Or Set oAntview = CreateObject( "AntViewAx2.Antview", "") '->Error: Type missmatch
End Function

Any idea?.. Huh
Thank You!

--
AlKalm
CrossCom GmbH
Reply
#2
Hello AlKalm,

We just tested it here for the AntView2 control and the following code worked for us.
Code:
Public WithEvents EdgeBrowser As AntviewAx2.Antview

Private Sub Form_Initialize()
  Dim Err As Boolean
  Dim ErrStat As AntviewAx2.TxWebErrorStatus
 
  Set EdgeBrowser = Controls.Add("AntViewAx2.Antview", "EdgeBrowser")
  EdgeBrowser.Top = 300
  EdgeBrowser.Left = 200
  EdgeBrowser.Height = 4000
  EdgeBrowser.Width = 10000
  EdgeBrowser.EventsUseHexadecimal = True
  EdgeBrowser.Visible = True
  EdgeBrowser.CreateWebView
  EdgeBrowser.UnlockControl "ExampleCompany", "WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F"
  EdgeBrowser.Navigate "https://www.microsoft.com"
' navigatesync does not work when you create the control like above
'  EdgeBrowser.NavigateSync "https://www.microsoft.com", Err, ErrStat
End Sub

Please be aware that in the case you installed AntView version 1.1 that the code needs to look a little bit different.

Code:
Public WithEvents EdgeBrowser As AntviewAx.Antview


Private Sub Form_Initialize()
  Dim Err As Boolean
  Dim ErrStat As AntviewAx.TxWebErrorStatus
 
  Set EdgeBrowser = Controls.Add("AntViewAx.Antview", "EdgeBrowser")
  EdgeBrowser.Top = 300
  EdgeBrowser.Left = 200
  EdgeBrowser.Height = 4000
  EdgeBrowser.Width = 10000
  EdgeBrowser.EventsUseHexadecimal = True
  EdgeBrowser.Visible = True
  EdgeBrowser.CreateWebView
  EdgeBrowser.UnlockControl "ExampleCompany", "WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F"
  EdgeBrowser.Navigate "https://www.microsoft.com"
' navigatesync does not work when you create the control like above
'  EdgeBrowser.NavigateSync "https://www.microsoft.com", Err, ErrStat
End Sub

We'll add an example of this to the standard examples just to make sure that it is easier to find on how-to do this.

--
Wil
Reply
#3
Hello, Wil!

It was a great help for me! By the way, I should figure it out myself... Confused
Thank You!

--
AlKalm
CrossCom GmbH
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)