Jump to content
xisto Community
Sign in to follow this  
rejected

Visual Basic 6.0 Help Needed Adding lines to a textbox without delete

Recommended Posts

I need help with Visual Basic 6.0 and adding lines to a textbox without deleting any previous lines.. I've gotten as far as finding a way to add the lines, but it deletes the prevous entree. Help is appreciated!

Share this post


Link to post
Share on other sites

Don't really understand what you are trying to do... Do you mean having a textbox that says:

"Hello My Name Is "

and then adding

"Rejected" to it?

Or do you mean

Rejected

Then adding "Hello My Name is.." above that?

 

Either way try just doing...

txtBox.text="Hello my name is..."txtBox.text=txtBox.text & "Rejected" 
OR

txtBox.text="Rejected"

txtBox.text="Hello my name is" & txtBox.text

Feel free to pm me if I didnt understand...Also sorry i havnt used VB in a while, I may be wrong

Share this post


Link to post
Share on other sites

Hi

That code works,but it doesn't add new lines,it just appends text at the end of existing one.To add a new line,you would type something like this.

Text1.Text = "This is line one in the textbox"Text1.Text = Text1.Text & vbCrLf & "This is line two in the textbox"

It is neccesary to use vbCrLf (Chr$(13) & Chr$(10)) because using only vbCr(Chr$(13)) or vbLf(Chr$(10)) will display single caracter,and won't insert new line.Hop this helped a bit.

Cheers

Share this post


Link to post
Share on other sites

Appends%20vs%20add%20item

Visual Basic 6.0 Help Needed

 

Well, I'm trying to load many random numbers one under another in a textbox, but when those items are about 30000 this process gets really slow. I'm using the same code:

 

Textbox = textbox & line & vbCrLf

 

But when the textbox is really big, then it became slow and slow. Is there any other way to add text at the end of the textbox multiline? Thanks.

 

-hotpadrino

Share this post


Link to post
Share on other sites

Appends%20vs%20add%20item

 

Visual Basic 6.0 Help Needed

Well, I'm trying to load many random numbers one under another in a textbox, but when those items are about 30000 this process gets really slow. I'm using the same code:

 

Textbox = textbox & line & vbCrLf

 

But when the textbox is really big, then it became slow and slow. Is there any other way to add text at the end of the textbox multiline? Thanks.

 

-hotpadrino


I can see that i can be slow, it's a lot of information... Do you need a user to see these numbers as they appear? If not, you can just fill the numbers to a variable, and then just display that variables' contents...

 

What makes this process slow, is that VB engine, refreshes the data every time you update your text box information... So, every time you add a new line, VB refreshes the entire Text property...

 

One way to solve this would be:

Dim i As LongDim s As StringFor i = 1 to 50000  s= s & Trim(Cstr(i)) & vbCrLfNext iText1.Text = s

This will add 50000 lines to variable s, and then assign s to text box Text1... Doing it this way, is much quicked, because VB doesnt have to refresh the text box 50000 times, only once...

 

Hope this helped...

Share this post


Link to post
Share on other sites

adding text in VB

Visual Basic 6.0 Help Needed

 

I am trying to create my own little word processor. My first goal is to add a character every time you press a button. I seem unable to add characters to the text box. My button click just replaces the text in the box with a single letter over and over. I just don't seem to know the code or property to do this. Help!

 

Text1.Text = "a"

 

(the code to have an "a" show up...My goal is to hit a button and have the same number of "a's" (in this case) show up. How to do?

Share this post


Link to post
Share on other sites

speed of vb6

Visual Basic 6.0 Help Needed

 

Replying to Galahad

 

I'm curious about the speed of vb6. Applications I have written are very slow, when it comes to calculating numbers, etc. Coordinates, prime numbers and so on. I made some kind of brute force prime number calculator and it is extremely slow. Similar kind of setup made with see++ works way much faster, so is there something wrong in vb6 or in my code?

Share this post


Link to post
Share on other sites

speed of vb6

 

Visual Basic 6.0 Help Needed

<a href=http://forums.xisto.com/topic/30880-visual-basic-60-help-needed-adding-lines-to-a-textbox-without-delete/ to Galahad</a>

 

I'm curious about the speed of vb6. Applications I have written are very slow, when it comes to calculating numbers, etc. Coordinates, prime numbers and so on. I made some kind of brute force prime number calculator and it is extremely slow. Similar kind of setup made with see++ works way much faster, so is there something wrong in vb6 or in my code?


Well, VB by design is kind of slow for some operations... I see that it would be slow on prime number calculations... Visual Basic is interpreted not compiled code, and from that comes its slowness... What youc oudl do, is create a project, and under Project options window, use optimisations like, "Optimize for fast code", enable "Favour pentium pro", and alike...

 

Also, try how different variable types affect the speed, integer, long, single, double...

 

Also, compiled code will run much faster than from IDE, always remember that...

Share this post


Link to post
Share on other sites

easy my friend

Visual Basic 6.0 Help Needed

 

Replying to Trap FeedBacker

 

Quite easy just add this to a command button

And put 3 textboxes on your form then cut & paste this :

 

Dim first As Integer

Dim second As Integer

first = Text1.Text

second = Text2.Text

Text3.Text = first + second

 

 

If your looking at some basic help try http://www.netboarder.com/search/vbhowto.netboarder.com

It only has a few things but its very basic but handy stuff :)

 

G

 

-reply by Gobble

Share this post


Link to post
Share on other sites

Transfering Results

Visual Basic 6.0 Help Needed

 

Replying to Trap FeedBacker

If I'm to assume you're using number values the code would be as follows:

 

Results=Val(Text1.Text)+Val(Text2.Text)

Text2.Text=str$(Results)

 

I hope this resolves your situation

 

 

-reply by Leo F

Share this post


Link to post
Share on other sites

How To Make A new line without deleting current line or adding to end of it

Visual Basic 6.0 Help Needed

 

1 you need to set the text box property to multiline=true or you have no chance

 

2 text1.Text = text1.Text + "WHATEVER" 0r text2.Text, + vbcrlf

 

Tada

 

CHEERS

 

-reply by john

Share this post


Link to post
Share on other sites

VB6 Text Book Control

Visual Basic 6.0 Help Needed

 

I have a text box and it's Multiple line option is enabled.

The Text books contains the following text

"This is normal"

"This is Bold"

"This is Italic"

I would be grateful if you kindly let me reply to get the desired results as mentioned.

 

Thanks

C

 

-question by Jayanta Bardalai

Share this post


Link to post
Share on other sites

VB6 Text Book Control

 

Visual Basic 6.0 Help Needed

I have a text box and it's Multiple line option is enabled.

The Text books contains the following text

"This is normal"

"This is Bold"

"This is Italic"

I would be grateful if you kindly let me reply to get the desired results as mentioned.

 

Thanks

C

 

-question by Jayanta Bardalai


Somewhat impossible. You can modify the entire textbox with .fontbold, .fontitalic, etc, but not individual lines.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.