5 Replies - 2083 Views - Last Post: 20 November 2011 - 02:35 AM Rate Topic: -----

#1 carbondz2010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 11

Do operation for each line in multiline textbox

Posted 19 November 2011 - 10:17 AM

Hello !!!

I am a new comer in visual basic 6

and I want to know how to do operation for each line in multiline text box
I'am using 2 form, and the second form is "er"

the result is shown in the same text box with the bold

I've set the formula
hasil.Text = er.pre.Text + hasil.Text + Right(er.su.Text, 1) + nf.Text + er.su.Text

if I inpot

statement1
statement2
statement3
statement4
statement5

then the result

Astatement1B
Astatement2B
Astatement3B
Astatement4B
Astatement5B

sorry for my bad english
thank you !!!
:bigsmile: :bigsmile: :bigsmile:

Is This A Good Question/Topic? 0
  • +

Replies To: Do operation for each line in multiline textbox

#2 AN1554  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 130
  • Joined: 03-April 11

Re: Do operation for each line in multiline textbox

Posted 19 November 2011 - 02:43 PM

View Postcarbondz2010, on 19 November 2011 - 10:17 AM, said:

hasil.Text = er.pre.Text + hasil.Text + Right(er.su.Text, 1) + nf.Text + er.su.Text


If I understand, you are concatenating strings into one textbox. It is advisable that you use the ampersand operator, i.e. &, instead of using the plus (+) sign. The plus sign is meant for addition in mathematical operations. So, your formula should be er.pre.Text & hasil.Text & etc.

For your question, you can try the Split function to read each line and store each in a variable to then manipulate it. You can base yourself on this.

This post has been edited by AN1554: 19 November 2011 - 02:46 PM

Was This Post Helpful? 0
  • +
  • -

#3 carbondz2010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 11

Re: Do operation for each line in multiline textbox

Posted 19 November 2011 - 07:56 PM

View PostAN1554, on 19 November 2011 - 02:43 PM, said:

If I understand, you are concatenating strings into one textbox. It is advisable that you use the ampersand operator, i.e. &, instead of using the plus (+) sign. The plus sign is meant for addition in mathematical operations. So, your formula should be er.pre.Text & hasil.Text & etc.


Thanks for your reply,

is there any problem if I using (+) in this string operation?
because it works, but if it make any problem, just tell me what
:sweatdrop:

Can you give me the script to get the result like this ?

input

statement1
statement2
statement3
statement4
statement5

result

Astatement1B
Astatement2B
Astatement3B
Astatement4B
Astatement5B
Was This Post Helpful? 0
  • +
  • -

#4 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Do operation for each line in multiline textbox

Posted 19 November 2011 - 08:09 PM

Sorry I have to sound like this, what have you tried? We can't give you code.

This post has been edited by jimmyBo: 19 November 2011 - 08:10 PM

Was This Post Helpful? 0
  • +
  • -

#5 carbondz2010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 11

Re: Do operation for each line in multiline textbox

Posted 19 November 2011 - 08:20 PM

I just want to try to make this in a multiline textbox

when I input

statement1(press ENTER)(LINE 1)
statement2(press ENTER)(LINE 2)
statement3(press ENTER)(LINE 3)
statement4(press ENTER)(LINE 4)
statement5 (LINE 5)
and so on...

then the result is

Astatement1B(LINE 1)
Astatement2B(LINE 2)
Astatement3B(LINE 3)
Astatement4B(LINE 4)
Astatement5B(LINE 5)
and so on...


Thank you !!!
:bigsmile:
Was This Post Helpful? 0
  • +
  • -

#6 AN1554  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 130
  • Joined: 03-April 11

Re: Do operation for each line in multiline textbox

Posted 20 November 2011 - 02:35 AM

View Postcarbondz2010, on 19 November 2011 - 07:56 PM, said:

is there any problem if I using (+) in this string operation?
because it works, but if it make any problem, just tell me what


"+" works but "&" is advisable.

View PostNoBrain, on 06 April 2011 - 08:06 AM, said:

I would suggest avoiding using + when placing together strings use & operator. It can result in unexpected errors (for example if you use string and the "+" operator and the other string contain number it can throw error for invalid cast).


You can try the Split function to read each line and store each in a variable to then manipulate it. You can base yourself on this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1