Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Visual Basic 6.0 Help Needed, Adding lines to a textbox without delete
rejected
post Dec 4 2005, 08:26 AM
Post #1


{([Mod])}
*********

Group: Members
Posts: 710
Joined: 30-October 04
From: Texas
Member No.: 2,058



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!
Go to the top of the page
 
+Quote Post
Eikon
post Dec 4 2005, 06:11 PM
Post #2


Member [Level 1]
****

Group: Members
Posts: 69
Joined: 4-December 05
Member No.: 15,309



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...
CODE

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

OR
[code]
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
Go to the top of the page
 
+Quote Post
Galahad
post Dec 4 2005, 06:26 PM
Post #3


Neurotical Squirrel
*********

Group: [HOSTED]
Posts: 590
Joined: 4-November 04
From: Novi Sad, Vojvodina
Member No.: 2,127



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.

CODE

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
Go to the top of the page
 
+Quote Post
iGuest
post Dec 21 2007, 07:46 PM
Post #4


Hail Caesar!
*********************

Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



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
Go to the top of the page
 
+Quote Post
Galahad
post Jan 4 2008, 10:00 AM
Post #5


Neurotical Squirrel
*********

Group: [HOSTED]
Posts: 590
Joined: 4-November 04
From: Novi Sad, Vojvodina
Member No.: 2,127



QUOTE(FeedBacker @ Dec 21 2007, 08:46 PM) *
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:
CODE
Dim i As Long
Dim s As String

For i = 1 to 50000
  s= s & Trim(Cstr(i)) & vbCrLf
Next i
Text1.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...
Go to the top of the page
 
+Quote Post
iGuest
post Jan 9 2008, 02:41 PM
Post #6


Hail Caesar!
*********************

Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



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?
Go to the top of the page
 
+Quote Post
iGuest
post Jan 20 2008, 06:22 AM
Post #7


Hail Caesar!
*********************

Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



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?
Go to the top of the page
 
+Quote Post
Galahad
post Feb 12 2008, 10:08 AM
Post #8


Neurotical Squirrel
*********

Group: [HOSTED]
Posts: 590
Joined: 4-November 04
From: Novi Sad, Vojvodina
Member No.: 2,127



QUOTE(FeedBacker @ Jan 20 2008, 07:22 AM) *
speed of vb6

Visual Basic 6.0 Help Needed
<a href=http://www.trap17.com/forums/index.php?showtopic=30880&view=findpost&p=366104>Replying 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...
Go to the top of the page
 
+Quote Post
iGuest
post Feb 13 2008, 03:15 AM