|
Posted by Steve on 10/02/07 22:34
"Jim Carlock" <anonymous@127.0.0.1> wrote in message
news:4702c543$0$20585$4c368faf@roadrunner.com...
> "Steve" wrote...
> : i think he meant the DAO used in the 'with' statement...
> : which is NOT a namespace but an object instance. i believe
> : his code sample above would fail anyway since i don't recall
> : DAO being a static class - static was introduced to vb in
> : vb.net.
>
> You're right. I've got to use a user-defined type, object or
> Variant with the With statement.
>
> Private Function ConnectToDb(sFQFN As String) As DAO.Database
> Dim oDb As DAO.Database
>
> With oDb
> Set oDb = DAO.OpenDatabase(sDb)
> 'Doesn't do much or show much here.
> 'But if we were to include an oRs As DAO.Recordset we then
> 'could use the following...
> '
> 'Set oRs = .OpenRecordset(sSQL)
> '
> 'And if so desired, we could return a DAO.Recordset.
> End With
> Set ConnectToDb = oDb
> End Function
>
> Good catch, Steve. I encoded it to confirm it.
i've spent years in many languages, paid to make the hell-marries. ;^)
here's one for you that i'm suprised you didn't come back with. in vb <
..net, you can create global objects that simulate static classes - in that
when the app is initialized, one instance of it is created. however, you
only call its methods and cannot refer to it as object.interface...just
interface. afaikr. either way, vb.net is the first version that has both
static classes and namespace support.
cheers.
[Back to original message]
|