Solved

General pointer needed (Just a quickie!)

Posted on 2000-02-23
3
134 Views
Last Modified: 2010-05-02
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
Comment
Question by:Matt_Unsworth
3 Comments
 
LVL 3

Accepted Solution

by:
jetforce earned 20 total points
ID: 2549949
try something like this

Dim x As String * 7
Dim i As Integer

i = 26


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


Jetforce
0
 
LVL 4

Expert Comment

by:TigerZhao
ID: 2549968
strVar = format(intVar, "0000000")
0
 

Author Comment

by:Matt_Unsworth
ID: 2550036
Cheers,

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

Matt
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now