-
I'm totally abusing the forum today... only 9:00 and already on my second question...
Anywayz, somebody at work wrote a program in basic a long time ago, now I have to convert it to visual basic. Well I'm stuck on this lil' bit of code here:
IF INSTR(InLine, "1.0000") = 14 THEN LPRINT " DX ";
IF INSTR(InLine, "1.0000") = 26 THEN LPRINT " DY ";
IF INSTR(InLine, "1.0000") = 38 THEN LPRINT " DZ";
I think it's searching for the string "1.000" at either the 14, 26, or 38 space. How do I do this in VB?
Once again, thanks in advance.
-
The If part of these statements would be the same in VB. You'll have to change the LPRINTs however, to direct them to whatever output option you want. (Print to form, Debug.Print, MsgBox, etc.)
-
Are you asking what the equivalent INSTR function is or what LPRINT does or how to simulate LPRINT or something else?
-
It should bascially be the Same in VB. Make a TextBox called InLine, and put the following code into a CommandButton.
When you click the button, it will search the TextBox for 1.0000 and if it's found on any of the given lines, it will print DX, DY, or DZ.
Code:
Private Sub Command1_Click()
If InStr(InLine, "1.0000") = 14 Then Print " DX "
If InStr(InLine, "1.0000") = 26 Then Print " DY "
If InStr(InLine, "1.0000") = 38 Then Print " DZ"
End Sub
-
I overlooked the Lprint and couldn't figure out why it was in all red... silly me... :D