Just wondering if the following code has an equivelant in VB Express.

Code Snippet
Function fCheckExchange()
Dim oSocket, iErr, sSocketText
sSocketText = ""
Set oSocket = CreateObject("Socket.TCP")
oSocket.DoTelnetEmulation = True
oSocket.TelnetEmulation = "TTY"
oSocket.Host = "trinity:25"
On Error Resume Next
iErr = Err.Number
If iErr <> 0 Then
fCheckExchange = 0
Exit Function
End If
sSocketText = oSocket.GetLine
oSocket.SendLine "quit"
On Error GoTo 0
fCheckExchange = 0
If InStr(sSocketText,"Microsoft ESMTP MAIL Service") <> 0 Then WScript.Echo "Exchange Found!"
End Function

Its so clean, any equivelant in VB I've found so far is mega mega ugly...

Also I have a language question.

.... if Visual Studio Express runs Visual Basic....

... and VB script is different than the Visual Basic of VB Express....

... How do you disambiguate the VB of VB express from VB Script


(just your average) EverydayHack

Re: Visual Basic Express Edition VB equivelant of VB script

Adamus Turner

Your first consideration should not be to become discouraged by new technology.

Don't look for equivalence, look for superiority.

VB Script is very forgiving in that undeclared instances were interpreted as variants which is fun if you're not concerned with overhead. Also, consider the environment of the language.

As an observation, your vb script is mostly left justified and would be difficult to read when it becomes lengthy and requires extra attention to format manually to enhance readability.

VB.net's IDE does all of the formatting work and some programming work for you.

Also, in a .net environment, you can still read from script files so if you don't want to re-learn what you already know, simply learn enough to read from your script files.


Re: Visual Basic Express Edition VB equivelant of VB script


Thanks for the help AT.

... and i don't know jack about VB script Smile so relearning is not a problem.

.... going to have to look up the definition of variant.....

I love the IDE in VB2k5EE

How about an example on how to read from script files Would that be utilizing processinfo and beginoutput readline

Re: Visual Basic Express Edition VB equivelant of VB script

Adamus Turner

Script files normally apply to a web environment mainly, in which case you would reference them as you would any other class through their run time libraries.

However, if you have no need to read from them (you're developing applications), take some time to learn stand alone application development in .net. You'll be a lot better off.


Re: Visual Basic Express Edition VB equivelant of VB script


Let me ask more directly.... I'm looking for a simple text stream from a number of telnet devices. I want to grab text and respond to specific prompts....

I doní»t want to use some type of third party kit, it seems this should be doable in VB from scratch... without having to write a whole telnet application from scratch.

Any ideas I mean if you point me to a ... method or object that should be able to get this done, that would be great but I can't find an example that would work....

So far the closest I've come is using a process for telnet.exe and redirectstandardoutput.... but things get complicated because its not like a simple directory command used in most examples. So I have to use beginoutputreadline in a smart way.... Which seems pretty close and I have no aversion to learning how to pump data to and from this asyncronus read operation but when I look at that VB Script, I yearn for simplicity.

And, I hate the web programmatically, I much prefer winform apps. The most successful software in the world was all winform.... so you're preaching to the choir there.