Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

General pointer needed (Just a quickie!)

Hi,

I'm new to the game - only just mastering VB fundamentals and don't have access to a  manual that provides an answer to this one. Can anyone help?

I am building a front end that sends data to /returns data from an AS/400 via .dll objects talking to AS400 data queues.

The nature of the AS400 dictates that the data is sent/received as a text string yet it will consist of a mixture of text & numeric values.

I need to be able to convert interger values to fixed length text strings that can then be re-converted at the AS400 end.

e.g

I have an item counter that takes up seven 'spaces' of the data block, passed to the data queue

If the integer value of that counter is 26

     Dim strVar as String * 7

     intVar Cstr strVar

Then strVar would look like this "26     "

I need to be able to send this data back to the AS400 as "0000026"

Any pointers?

Cheers,

Matt
0
Matt_Unsworth
Asked:
Matt_Unsworth
1 Solution
 
jetforceCommented:
try something like this

Dim x As String * 7
Dim i As Integer

i = 26


x = Format(CStr(i), "0000000")
MsgBox x


Jetforce
0
 
TigerZhaoCommented:
strVar = format(intVar, "0000000")
0
 
Matt_UnsworthAuthor Commented:
Cheers,

Clean, simple effective; (why did I not think of that, DOH.........)

Matt
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now