kf2zq

Greetings,

I am looking for the VB2005 equivalent to the following lines of code:

Dim strRes As String * 200

Call viVScanf (vi, "%t", strRes)

These were witten in VB6.

Thanks in advance for all comments that are provided

Thanks from a NewBee

Scott



Re: Visual Basic Language Need VB2005 equivalents

John Oliver (UK)MSP, VSIP

Hi,

The 1st line is a 200 character vbFixed string translated initially to.>>

'Dim strRes As New VB6.FixedLengthString(200)

you might need it as

<VBFixedString(200)> Dim strRes As String

What is the 2nd line doing with the STRING

I presume vi is the result returned by the viVScanf function or Sub and %t is a STRING format maybe

Regards,

John.

_______________

Here is my attempt which uses one button on a FORM.>>

Code Snippet

Public Class Form1

'The next highlighted line should be one line in your code window.>>

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Call the Public Sub in module1 called "RunMe"

Call runMe()

End Sub

End Class

Public Module module1

'Dim strRes As New VB6.FixedLengthString(200)

<VBFixedString(200)> Dim strRes As String

Public Sub runMe()

Dim vi As String = ""

'Put 200 capital letter H's into the fixed string.

For myNum As Integer = 1 To 200

strRes &= "H"

Next

Call viVScanf(vi, strRes)

MessageBox.Show(vi)

End Sub

Public Function viVScanf(ByRef vi As String, ByVal aString As String)

'Convert to lower case.

aString = aString.ToLower

vi = aString

Return vi.ToString

End Function

End Module






Re: Visual Basic Language Need VB2005 equivalents

kf2zq

Greetings John,

The first part was helpful, but the second part doesn't return the result that I'm expecting. Here is the entire program that is in Visual Basic 6 format. I'm just interested in the lines that are in BOLD print. I figured out the rest, which is working fine. I'm curious about the meaning of the "%t" as well.

Option Explicit
Sub Main()
Dim defrm As Long
Dim vi As Long


Dim strRes As String * 200

Call viOpenDefaultRM(defrm)

Call viOpen(defrm, "GPIB1::19::INSTR", 0, 0, vi)

Call viVPrintf(vi, "*RST" + Chr$(10), 0)

Call viVPrintf(vi, "*IDN " + Chr$(10), 0)

Call viVScanf(vi, "%t", strRes)

MsgBox "Result is: " + strRes, vbOKOnly, "*IDN Result"

Call viClose(vi)
Call viClose(defrm)
End Sub

I removed the "Chr$(10), 0"'s with "vbCrLf"

Thank you in advance for any additional help with my thread.

Scott





Re: Visual Basic Language Need VB2005 equivalents

John Oliver (UK)MSP, VSIP

Hi Scott,

I can not find any result for

viVScanf

on searching Microsoft.com

can you tell me the results it gives

See this GOOGLE page please.>>

http://www.google.co.uk/search hl=en&q=viVScanf&meta=

See the 4th link on that page in particular.

Regards,

John.






Re: Visual Basic Language Need VB2005 equivalents

kf2zq

Hi John,

Yes indeed. The google search of the viVScanf is the right call. The code that I listed was for VB6, and I'm trying to convert it to VB2005. Please excuse me as I am very new to this computer language and still have a tremendous amount to learn.

I removed the second "V" from viVPrinf with a result of viPrintf and those functions work just perfectly. Sending commands to the equipment, but not receiving strRes back from the equipment.

Basically the data should resemble the following:

+5.7000000000000E+08

-1.10000000E+002

I also changed the viVScanf to viScanf, which the environment seems to like but I get no results as listed above.

Thank you for sticking in with me during my learning curve. I appreciate it greatly.

Scott





Re: Visual Basic Language Need VB2005 equivalents

nobugz

You'll need to contact the measurement system software vendor (Agilent) for support. These are not standard Visual Basic functions.





Re: Visual Basic Language Need VB2005 equivalents

John Oliver (UK)MSP, VSIP

Hans ( userID nobugz ) is correct,

I came across lots of references for Agilent but didn't follow up the search further ( due to lack of sleep ).

To contact Agilent click here: >>>>

http://www.home.agilent.com/agilent/contactInformation.jspx ct=AGILENT_COLLECTION&id=worldwide_home&cc=US&lc=eng

Regards,

John.






Re: Visual Basic Language Need VB2005 equivalents

kf2zq

Hi John,

Thanks for your help.

I had already contacted Agilent and so far they are no help. Considering the fact that the program comes straight out of one of there manuals.

This has been one educational ride so far.

Again many thanks for you assistance.

Take care,

Scott