Loading...


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

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

 
 Discussion by rejected with 21 Replies.
 Last Update: February 10, 2010, 7:51 am
 
bookmark - Visual Basic 6.0 Help Needed Adding lines to a textbox without delete  
Quickly Post to Visual Basic 6.0 Help Needed Adding lines to a textbox without delete w/o signup Share Info about Visual Basic 6.0 Help Needed Adding lines to a textbox without delete using Facebook, Twitter etc. email your friend about Visual Basic 6.0 Help Needed Adding lines to a textbox without delete Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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!










   Sun Dec 4, 2005    Reply         

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







   Sun Dec 4, 2005    Reply         

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

   Sun Dec 4, 2005    Reply         


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

   Fri Dec 21, 2007    Reply         

QUOTE (FeedBacker)

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
Link: view Post: 363911


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

   Fri Jan 4, 2008    Reply         

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?

   Wed Jan 9, 2008    Reply         


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?

   Sun Jan 20, 2008    Reply         

QUOTE (FeedBacker)

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?
Link: view Post: 369437


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

   Tue Feb 12, 2008    Reply         

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

   Wed Feb 13, 2008    Reply         

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

   Wed Feb 13, 2008    Reply         

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://vbhowto.Netboarder.Com/
It only has a few things but its very basic but handy stuff :)

G

-reply by Gobble

   Thu Feb 14, 2008    Reply         

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

   Tue Mar 25, 2008    Reply         

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

   Sun Jun 15, 2008    Reply         

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

   Wed Jul 2, 2008    Reply         

QUOTE (iGuestJayanta Bardalai)

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
Link: view Post: 398010



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

   Tue Jul 29, 2008    Reply         

QUOTE (iGuestJayanta Bardalai)

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
Link: view Post: 398010


With standard TextBox you can't have multiple fnt styles... If you want that, then use RichTextBox control, that allows multuple font styles, colors and others...

   Wed Aug 13, 2008    Reply         

Text box filter
Visual Basic 6.0 Help Needed

Text1.Text = wate 100.00 g
I need
Text2.Text = 100.00


-reply by shahid

   Mon Nov 3, 2008    Reply         

My dear friend it is very easy to add text lines to a text box keeping the existing line intact. 
For example:
You have two variables a and b
and a text box named text1

a = “Visual Basic ”
b = “ Is a programming language”

If we code as 
text1.text = a
---
then text1 which show Visual Basic, if we want to add the second line that is the value of variable b to the current text then the following code is applicable

text1.text = text1.text & b

or 

text1.text = a & b

both the coding gives the same results that is 

Visual Basic Is a programming language

   Fri Nov 28, 2008    Reply         

Re: VB6 Text Book ControlVisual Basic 6.0 Help Needed

Hello, Jayanta Bardalai.See: RTF (Rich Text Formatting) Text Box Controls (RICHTX32.OCX) to achieve this.For instance, a function I made for RTF boxes that works for inputting different colours:

 

Public Function OutputToScreen(ByRef strOutput As String, Optional ByRef lngColour As Long = &HC0C0C0, Optional ByRef bytAmountEnters As Byte = 0)With frmMain.RtbScreen .SelStart = Len(.Text) .SelColor = lngColour .SelText = String(bytAmountEnters, Asc(vbCrLf)) & strOutputEnd WithEnd Function

 

You may have to alter the code slightly to adjust to your desires.-Donkano

-reply by Donkano

   Tue Dec 2, 2008    Reply         

You roxx baby...........Visual Basic 6.0 Help Needed

Replying to EikonI just wanna say, that because of you I have got 48/50 marks in vb...I just wanna thank you a lot... I bless God that u get everything you want in lyf...THAAAAANXXXX

-feedback by Swapnil Godse

 

   Mon Nov 9, 2009    Reply         

I need a help how to connect sql2000 to vb6.0


CODE

Option Explicit
Dim myDB As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub cmdLogIn_Click()

Dim rs As ADODB.Recordset
' Set rs = New ADODB.Recordset
' rs.Open "Select UserName, Password FROM userinfo", myDB, adOpenStatic, adLockReadOnly


If txtUsername.Text = "" Or txtPass.Text = "" Then
MsgBox "You must fill in UserName or Password", vbCritical, "ERROR"
txtUsername.SetFocus
Exit Sub
End If


Do While Not rs.EOF

' If UCase(txtUsername.Text) = UCase(rs.Fields!UserName) And UCase(txtPass.Text) = UCase(rs.Fields!Password) Then
If (UCase(txtUsername.Text) = UCase(rs.Fields!UserName)) And (UCase(txtPass.Text) = UCase(rs.Fields!Password)) Then
MsgBox "You are Now LogIn"

frmMain.Show
frmLogIn.Visible = False
frmMainFrame.Visible = False

Else

MsgBox "Wrong Input"

frmLogIn.Show

End If
Exit Sub

rs.MoveNext
Loop

End Sub




'Set myDB = New ADODB.Connection ' to connect to sqlserver
' myDB.ConnectionString = "Provider=SQLOLEDB;Server=" & "STI-46901090D95" & ";Initial Catalog=" & ";UID=" & "sa" & ";PWD=" & "sti" & ""
' myDB.Open "DSN=STIBAKE" ' master is database name

'Set rs = New ADODB.Recordset
'rs.Open "Select UserName, Password FROM userinfo", myDB, adOpenStatic, adLockReadOnly



'On Error Resume Next
'Set Connstr = New Connection
'Connstr.ConnectionString = "Provider=SQLOLEDB;Server=" & "STI-46901090D95" & ";Initial Catalog=" & "STIBAKE" & ";UID=" & "sa" & ";PWD=" & "sti" & ""
'Connstr.Open
' Dim rs As Recordset
' Set rs = New Recordset
'rs.Open "Select UserName,Password FROM userinfo", Connstr, adOpenStatic, adLockOptimistic





' Dim rs As ADODB.Recordset
' Set rs = New ADODB.Recordset
' rs.Open "Select UserName, Password FROM userinfo", Connstr, adOpenStatic, adLockReadOnly



'End Sub


Private Sub Form_Load()

On Error Resume Next
Set myDB = New ADODB.Connection
myDB.Open "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source =" & App.Path & "\db1.mdb;"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM TABLE1", myDB, adOpenStatic, adLockOptimistic
End Sub

   Thu Feb 4, 2010    Reply         

Files in vb6Visual Basic 6.0 Help Needed

Greetings!How to read multiline text file and how to display those lines into combo/list box?

Details:Say,a file "ProjectList.Txt" contains list of projects...Just I wan a read those names of project and wan a display those into combo...So that I can select any one of them for further process...

Thank you...

-reply by teju

   Wed Feb 10, 2010    Reply         

Quickly Post to Visual Basic 6.0 Help Needed Adding lines to a textbox without delete w/o signup Share Info about Visual Basic 6.0 Help Needed Adding lines to a textbox without delete using Facebook, Twitter etc. email your friend about Visual Basic 6.0 Help Needed Adding lines to a textbox without delete Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Simple Login In Visual Basic 6

First of all, I am NOT a programmer, this is something my friend taught me. It describes basic interaction with the user, while showing basic functionality of this simple programm. So, without further ado, we're off to the tutorial: First of all, start your visual basic, when prompt ...more

   15-Jun-2005    Reply         

Mysql In Visual Basic

I'm am trying to create a script so that visual basic 6 can interact with mysql Any ideas? ...more

   23-May-2007    Reply         

Visual Basic For The Web?

Ok, I have heard that you can use Visual Basic to create websites and I have found controls for the web inside of my VB 2005 Express Edition, and I am curious as to how I would use these and create applications for websites? I know there is ASP.NET, but how is VB.NET used on the web? I do know PHP i ...more

   17-Jan-2009    Reply         

Cal & Gp4    Cal & Gp4 (1) (3) Vb Mass E-mailer   Vb Mass E-mailer