473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Array not printing out beginning and end

This is a formula I am writing in Crystal Reports and vb is the closest thing to it so hopefully someone can figure this out.

I am dealing with a long string that looks like 0.0055;0;0;0;0. It looks like an array but doesn;t act like on. For example, I only need the first value but if I ask for myArray[1], I get "0", myArray[2] yields ".", etc. So I created this for loop to get what I want:

Expand|Select|Wrap|Line Numbers
  1. numbervar i;
  2. stringvar str := "";
  3.  
  4. for i := 1 to instr(1,{lt_mtg_ins.pmi-pymt-ftrs},";")-1 Do
  5. (
  6.     str := str + {lt_mtg_ins.pmi-pymt-ftrs}[i];
  7.     i := i + 1;
  8. );
  9. str
  10.  
Basically it starts at 1 and goes until the first semicolon. It adds each value to the end of the string until it is finished.

Problem is for 0.0055;0;0;0;0, the resulting string is 005. Does anyone know what is going wrong here?
Apr 7 '11 #1

✓ answered by Guido Geurs

This code (vb6) will split (delimited with ";") the text from textbox "Text1" in an array "ARRtemp" and put the first string (index=0) in a textbox "Text2" = "0.0055".
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim ARRtemp() As String ' array with splitted text
  3.    ARRtemp = Split(Text1.Text, ";") 'split Text1.text on ";"
  4.    Text2.Text = ARRtemp(0) ' put 1st string in textbox
  5. End Sub

2 1343
Guido Geurs
767 Expert 512MB
This code (vb6) will split (delimited with ";") the text from textbox "Text1" in an array "ARRtemp" and put the first string (index=0) in a textbox "Text2" = "0.0055".
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim ARRtemp() As String ' array with splitted text
  3.    ARRtemp = Split(Text1.Text, ";") 'split Text1.text on ";"
  4.    Text2.Text = ARRtemp(0) ' put 1st string in textbox
  5. End Sub
Apr 8 '11 #2
I used your logic to figure it out, the answer in crystal would be simpler though,

Expand|Select|Wrap|Line Numbers
  1. stringvar array text;
  2.  
  3. text := Split({lt_mtg_ins.pmi-pymt-ftrs}, ";");
  4. text[1]
  5.  
Apr 8 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I've noticed a few threads (full of sound and fury, signifying nothing) here recently about allocation of large memory blocks. I'm about to start on a personal pet project where I'll be using...
39
by: hpy_awad | last post by:
I know that group is for C not for C++ but please try to help me , How can I declare size of an array as variable value came from screen? #include "iostream.h" #include "iomanip.h" #include...
0
by: Mark Gibson | last post by:
Hi, I've been playing about with array's, and found the concat operator '||' quite useful, apart from the fact that prepending an element places it in a lower subscript. Is there a way of...
6
by: JoeC | last post by:
I am trying to write a graphic library. Yes, I know that it is byoined the scope of this group but I broke the file down to reading a text file of numbers. The problem I am having is that the...
0
by: Mr:waly | last post by:
hi there, I have an array of about 22 text boxs ,the array is to be printed , the problem is that when the printer starts the second page I could not set the location of the rest of the array...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
7
by: Franky | last post by:
Following discussion in a previous post, i have used an array inside a loop to gather results: //Function called from another page function displayQuestions($ModNum){ //modnum is used...
2
by: niskin | last post by:
I want an an array called "message" that I can fit 125 characters into and I want to be able to print that array to a text file. Here is what I have tried: char message; cout<< computera...
7
by: =?utf-8?B?5YiY5piK?= | last post by:
Hi, folks, Is it possible to delete an element from a sorted array with O(1) time? Best regards
8
by: Jack | last post by:
I would like to Explode a string into an array that does not begin at 0 but I can't get it to work. For example: $MyInfo = array(1 =27,68,31,19,40); will result in $MyInfo = 27 ... $MyInfo = 40...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.