Hi all, I have a question regarding VB and Navision. I am trying to create an OCX. For some reason I’m getting an error (object not set) when running the following code:Option Explicit Function Http(vRemoteHost As String, vDocument As String) As Integer Dim vInet As Inet ’ here the error starts ’ inet is an object (Microsoft internet transfer protocol), being set in the components form in VB. On Error GoTo ErrorHandler With vInet .RemoteHost = vRemoteHost .Document = vDocument .OpenURL End With ErrorHandler: 'Http = Err.Number //commented out 'RunHttp = http.ResponseCode //commented out MsgBox "Here is the error: " & _ "Error Number: " & Err.Number & _ vbCrLf & vbCrLf & Err.Description End Function Any help is welcome. Thanks, Roelof.
Does Inet show in the auto-complete list of types after typing the word “as”? If not, does it show when typing the word “new”? If yes, you have to take the two step approach. First Dim vInet as Object, then Set vInet as New Inet John
Hi John, Thanks for your reply. Yes, it shows up on the list. As soon as I type ‘as’ i get a box on screen from where I can pick ‘Inet’. (dim vInet as object set vInet as new Inet 'that doesnt work) Any other suggestions? Roelof.
Okay, sorry. Was replying from a place with no VB nearby. It’s in fact much simpler to use this control. 1) Add INet to the toolbar 2) Place the Inet control on your form 3) access the control through its methods and properties. For example: Text1.Text = Inet1.OpenURL(“http://www.navision.net”) (Text1 is a textbox with MultiLine = True) You can perform a lot of things now, including FTP transfer, HTTP commands, call CGI scripts etc. Checkout the VB Help for details. John
That was my second thought. But we want to be flexible. All the used variables are being set by Navision and the ‘document’ property you see in my code is being used in 3 different ways.
No problem, I think. Just leave out the Dim vInet as Inet line in your code and name the Inet control you’ve put on the form “vInet”. Be aware though which properties/methods are input and which return something. For example OpenURL returns the content of the HTML file you are pointing to, so you must give this output a storage place. John
I tried to give the control a name, but there is no option to give it a name at all. It’s very weird.
Oops. I figured it out myself. I didnt have my property-form on screen. It works John. And thanks for your help. PS: ben je nederlander of engelsman?want je engels is goed.
Roelof, Zo Hollands als maar zijn kan. Maar nogal veel bezig met internationale projecten en dan kun je het Engels aardig oefenen. For other readers: I replied to Roelof I’m as Dutch as one can be, but as I’m quite a bit involved with international projects I do have the chance of practising English a lot. John
Ok en nog bedankt voor je hulp.