473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to declare an array in textbox.

Parul Bagadia
188 100+
Hello folks,
I tried lot many methods for displaying an array in textbox, i thought of converting that array in string; so that i can directly assign it to textbox as textbox is also a string; i used Join for that matter...But it was giving very unpredictable result all the time.
I used Debug.print as well; but that was giving output in debug window and not in TextBox..i even tried my hand on Response.Write; but that was giving some kind of error; i dont recollect it;
Can somebody plz tell me how will i display an array in textbox?
Sep 10 '08 #1
8 7064
kadghar
1,295 Expert 1GB
well

it does depend on what version of VB you're using

but in most oldie versions and in vba, as you said, the JOIN function should do

try this little example :

Expand|Select|Wrap|Line Numbers
  1. dim myArr(1 to 10) as string
  2. dim Str1 as string
  3. dim i as integer
  4.  
  5. for i = 1 to 10
  6.     myarr(i)=i
  7. next
  8. text1.text=join(myarr)
HTH
Sep 10 '08 #2
Parul Bagadia
188 100+
well

it does depend on what version of VB you're using

but in most oldie versions and in vba, as you said, the JOIN function should do

try this little example :

Expand|Select|Wrap|Line Numbers
  1. dim myArr(1 to 10) as string
  2. dim Str1 as string
  3. dim i as integer
  4.  
  5. for i = 1 to 10
  6.     myarr(i)=i
  7. next
  8. text1.text=join(myarr)
HTH
But there are two arguments in join function, first one array and second one delimiter, the meaning of which i had to search first!
Wont it affect the fuctionality, coz if we dont pass any value it must be taking it as garbadge,right?
Sep 10 '08 #3
kadghar
1,295 Expert 1GB
But there are two arguments in join function, first one array and second one delimiter, the meaning of which i had to search first!
Wont it affect the fuctionality, coz if we dont pass any value it must be taking it as garbadge,right?
The delimiter is optional, its default is a blank space. If you dont want it to be there, just do something like:

Expand|Select|Wrap|Line Numbers
  1. text1.text = join(myArr, "")
HTH
Sep 10 '08 #4
Parul Bagadia
188 100+
The delimiter is optional, its default is a blank space. If you dont want it to be there, just do something like:

Expand|Select|Wrap|Line Numbers
  1. text1.text = join(myArr, "")
HTH
I did as u said but its not working; nothing is getting inserted in Text2.text.. m having VB 6.0
Sep 10 '08 #5
Parul Bagadia
188 100+
Finally i could display it; but it didnt work with Text2.text=Join(array,""); but when i assigned it to some other string; and later that value from the function and assigned it to Text2.text then only it worked.
Because text2.text is global right?..
Sep 11 '08 #6
kadghar
1,295 Expert 1GB
Finally i could display it; but it didnt work with Text2.text=Join(array,""); but when i assigned it to some other string; and later that value from the function and assigned it to Text2.text then only it worked.
Because text2.text is global right?..

its not a variable, its a property.
but yes, you can asign a variable to it.
Sep 11 '08 #7
Parul Bagadia
188 100+
its not a variable, its a property.
but yes, you can asign a variable to it.
Thanks. But i still havnt undestood why the join thing didnt work with text2.text?
If we can assign a variable to it; we sould be in position to perform operations on it like Join.
Sep 11 '08 #8
QVeen72
1,445 Expert 1GB
Hi,

JOIN Requires and Array and a Delimitter,
So should work..

Text1.Text = Join(MyArr, ",")

When you are displaying Contents of an Array,
Display it in a ListBox, that will be more Appropriate
OR Make TextBox' MultiLine =True and
like :
Expand|Select|Wrap|Line Numbers
  1. List1.Clear
  2. For i= 1 To 100
  3.     List1.AddItem MyArr(i)
  4.     Text1.Text = Text1.Text & vbcrlf & MyArr(i)
  5. Next
  6.  
Regards
Veena
Sep 11 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Bhavin | last post by:
Anybody quickly replies it, would be a great help! I try to create dynamic array of textboxes control in ASP.NET(C#). I got the following error while I tried to assign value to ID property of...
4
by: Shapper | last post by:
Hello, I have a label as follows: <label id="lName" for="name">Name:<input type="text" id="name"></input></label> I need to declare the label in my page.aspx.vb so I can access it on page...
3
by: Newcomsas | last post by:
Hello, I'm trying to solve a problem with JS textbox array without success. I have two buttons in my page: PLUS and MINUS; at every click on PLUS a new textbox named 'dear' is generated. So, if...
1
by: GL | last post by:
I am trying to develop a prgram that randomly selects numbers for an addition program, then when the check answer button is pressed it colors the answer text field either green or red depending if...
4
by: Rich | last post by:
Hello, I have 3 textboxes and 1 combobox on a form. On entering the control I want to select all the text. I can make an array of textboxes like this: Dim arrTxt As TextBox() = {txt1, txt2,...
6
by: Rich | last post by:
Hello, I have an application that contains several checkboxes. I originally created this app in VB.Net 2003 and upgraded the app to VB.Net 2005. I understand the vb2005 supports control...
9
by: jan82 | last post by:
Hi everybody I declared a private static array of textboxes at the top of a class, then i generate the array elements (new textbox()) in a separate function (private void in the same class), ...
8
by: redefined.horizons | last post by:
I would like to have an array declaration where the size of the array is dependent on a variable. Something like this: /* Store the desired size of the array in a variable named "array_size". */...
1
by: Nightfarer | last post by:
Hello. I have a big trouble using System.Array class (it's the first time I use it) for a software I'm developing. I have a form with a textbox(numbers) and one button (done). Once the number...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.