Hi.. Would really be glad to have some help on textBox .
From what i know of textbox , the old value that u assign to it will always be replace by the new ones. Example : - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim array(4) As String
-
array(0) = 6
-
array(1) = 6
-
array(2) = 6
-
array(3) = 6
-
array(4) = 6
-
For n As Integer = 0 To 4
-
-
TextBox1.Text = array(n)
-
-
Next
-
-
End Sub
The output will only be one 6 on the textBox. However i want five 6 to be listed on the textbox. Is there a line break or something so that i can print all things in the array? I know i can use the listbox to achieve that but then i am not able to copy the words from the listbox
12 4490
Hi.. Would really be glad to have some help on textBox .
From what i know of textbox , the old value that u assign to it will always be replace by the new ones. Example : - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim array(4) As String
-
array(0) = 6
-
array(1) = 6
-
array(2) = 6
-
array(3) = 6
-
array(4) = 6
-
For n As Integer = 0 To 4
-
-
TextBox1.Text = array(n)
-
-
Next
-
-
End Sub
The output will only be one 6 on the textBox. However i want five 6 to be listed on the textbox. Is there a line break or something so that i can print all things in the array? I know i can use the listbox to achieve that but then i am not able to copy the words from the listbox
Make the TextBox Property Multi line =True
and - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim array(4) As String
-
array(0) = 6
-
array(1) = 6
-
array(2) = 6
-
array(3) = 6
-
array(4) = 6
-
For n As Integer = 0 To 4
-
-
TextBox1.Text = array(n) & vbcr
-
-
Next
-
-
End Sub
Make the TextBox Property Multi line =True
and - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim array(4) As String
-
array(0) = 6
-
array(1) = 6
-
array(2) = 6
-
array(3) = 6
-
array(4) = 6
-
For n As Integer = 0 To 4
-
-
TextBox1.Text = array(n) & vbcr
-
-
Next
-
-
End Sub
Hi i have set the multiline to true and edit this line
TextBox1.Text = array(n) & vbcr
However the output display is still the same. only one 6
hihi forgot to mention that i am using VB 2005 express edition. Thanks!
hihi forgot to mention that i am using VB 2005 express edition. Thanks!
This is a fundamental rule - assigning a value to a property or variable replaces what was there previously. You cannot append a value to it.
What you need to do is think carefully about what you want to put there. In a case like this, what you want to put there is the old value plus the new value, isn't it? So put that in there.
hihi forgot to mention that i am using VB 2005 express edition. Thanks!
what'er Vb version this is also a way. okay Explain your problem with some other example...
I'll give you another hint.
If you have a string variable, and you want to add something onto the end of it, what do you do?
Let's say MyString = "ABC"
How would you add, say, a "D" onto the end, using code?
You do the same with a textbox.
I'll give you another hint.
If you have a string variable, and you want to add something onto the end of it, what do you do?
Let's say MyString = "ABC"
How would you add, say, a "D" onto the end, using code?
You do the same with a textbox.
okay I got the prob, - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim array(4) As String
-
array(0) = 6
-
array(1) = 6
-
array(2) = 6
-
array(3) = 6
-
array(4) = 6
-
TextBox1.Text = ""
-
For n As Integer = 0 To 4
-
-
TextBox1.Text = TextBox1.Text & array(n)
-
Next
-
-
End Sub
-
-
-
Change the Code line to :
-
TextBox1.Text = TextBox1.Text & array(n) & vbcr
Oh nuts! I was trying to encourage dr3amxstar to work it out.
Oh well...
Keep in mind dr3amxstar, you only want to add on the vbcrlf (actually, I'd recommend vbNewLine) if you want a line break between the values. You can stick them together without the breaks.
hello
you can use the following statement while at the time of inserting text
text1.text=text1.text & array(n) & vbcrlf
thanks
Oops i thought nobody was replying to my thread and i managed to figured it out :D anyway thanks for all the help given!! I really did learn alot from this forum :D - TextBoxForm2c.AppendText(source3 & vbCrLf & accuracy & vbCrLf)
Glad we could help.
It's good that you were able to work it out. I prefer to try and help people work out the answer rather than just giving it to them outright, anyway. Copy/paste generally doesn't teach you much.
Glad we could help.
It's good that you were able to work it out. I prefer to try and help people work out the answer rather than just giving it to them outright, anyway. Copy/paste generally doesn't teach you much.
yup! by trying out myself i understand what i am doing :D
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nurchi BECHED |
last post by:
Hello, All!
I have created an application with a multiline textbox on the form.
When I press a button, it has to show something and then break
the line and show something else.
I tried "\n",...
|
by: Mr.Baha |
last post by:
Hello,
I have a situation where I am appending text to a multi-line
(rich)textbox in a C# form. Now depending on which event does the
appendtext, i want to distinguish the lines in the textbox by...
|
by: VMI |
last post by:
In my Windows app, if I'm in a multi-line textbox and I'm writing a postal
address (ie. write ist line and press <Enter>, write 2nd line and press
<Enter>, etc...) how can I make sure that the...
|
by: Maziar Aflatoun |
last post by:
Hi,
I have a little application that reads a text file line-by-line and
processes each line depending on the CVS values. Now I want to change my
program to capture this from a textbox. How do...
|
by: Mike |
last post by:
I need my textbox to work more smoothly with respect to line breaks.
When I have data pulled from the database into a textbox there are hard
line breaks at the end of each line (by definition how...
|
by: DraguVaso |
last post by:
Hi,
For my application I need the following behavior: When I press F4 the cursor
has to move to the next line in my multiline textbox which begins with "0".
Finding lines starting with 0 isn't...
|
by: zoneal |
last post by:
I have a multi line textbox with word wrap enabled. Is it possible to
write code to check if the text of the textbox has continued into the
next line and then count the amount of lines?
If not...
|
by: garyusenet |
last post by:
I have a multi line text box, i'd like to store the contents of this
textbox to a text file. However when I write the value of '
textbox.text ' to the file it is written verbatim spanning many...
|
by: Boki |
last post by:
Hi All,
My textbox is a queue stack, after processing a line, I need to
process next line, and the first line should be removed to indicate
progress.
Should we check the new line by ourself ?...
|
by: Gregory Leck |
last post by:
I can import a .txt document into a TextBox
Each line in the TextBox contains a URL, for example, http://www.whateverdomain.com
I would like to convert each URL to the following format:
<a...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |