|
|
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 | |||
![]() |
|
|
Help is appreciated!
"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
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
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
QUOTE (FeedBacker)
Appends%20vs%20add%20itemVisual 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 LongDim 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...
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?
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?
QUOTE (FeedBacker)
speed of vb6Visual 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...
pls. Help me. Ty.
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
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
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
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
QUOTE (iGuestJayanta Bardalai)
VB6 Text Book ControlVisual 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.
QUOTE (iGuestJayanta Bardalai)
VB6 Text Book ControlVisual 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...
Visual Basic 6.0 Help Needed
Text1.Text = wate 100.00 g
I need
Text2.Text = 100.00
-reply by shahid
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
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
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
CODE
Option ExplicitDim 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
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
Similar Topics:
Simple Login In Visual Basic 6
Mysql In Visual Basic
Visual Basic For The Web?
Cal & Gp4 (1)
|
(3) Vb Mass E-mailer
|
Loading...
HOME 






