Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Visual Basic 6.0 Help Needed


21 replies to this topic

#1 rejected

    Super Nuclear Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 743 posts
  • Gender:Male
  • Location:Texas
  • Interests:I enjoy running cross country and track, and the occasional cocktail with some friends.
  • myCENT:51.02

Posted 04 December 2005 - 08:26 AM

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!

#2 Eikon

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 69 posts

Posted 04 December 2005 - 06:11 PM

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
[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

#3 Galahad

    Neurotical Squirrel

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 590 posts
  • Gender:Male
  • Location:Novi Sad, Vojvodina
  • Interests:Programming, Hardcore dance/Trance/House music. Girls, girls and more girls ;) ... In short, everything youg people like, I like :D Oh yeah, and dont't forget politics :)
  • myCENT:48.25

Posted 04 December 2005 - 06:26 PM

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

#4 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 21 December 2007 - 07: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

#5 Galahad

    Neurotical Squirrel

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 590 posts
  • Gender:Male
  • Location:Novi Sad, Vojvodina
  • Interests:Programming, Hardcore dance/Trance/House music. Girls, girls and more girls ;) ... In short, everything youg people like, I like :D Oh yeah, and dont't forget politics :)
  • myCENT:48.25

Posted 04 January 2008 - 10:00 AM

View PostFeedBacker, on Dec 21 2007, 08:46 PM, said:

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

#6 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 09 January 2008 - 02:41 PM

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?

#7 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 20 January 2008 - 06:22 AM

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?

#8 Galahad

    Neurotical Squirrel

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 590 posts
  • Gender:Male
  • Location:Novi Sad, Vojvodina
  • Interests:Programming, Hardcore dance/Trance/House music. Girls, girls and more girls ;) ... In short, everything youg people like, I like :D Oh yeah, and dont't forget politics :)
  • myCENT:48.25

Posted 12 February 2008 - 10:08 AM

View PostFeedBacker, on Jan 20 2008, 07:22 AM, said:

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

#9 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 13 February 2008 - 03:15 AM

Greetings!, how can I make a textbox1.Text adding to textbox2.Text and the result goes to textbox2? pls. Help me.Ty.

#10 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 13 February 2008 - 03:17 AM

Greeting!, how can I add textbox1 to texbox2 and the result goes to textbox3?
pls. Help me. Ty.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users