473,396 Members | 1,998 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,396 software developers and data experts.

How to display 3 arrays in a single label?

How to display a 3 arrays in a single label?
as in:
Expand|Select|Wrap|Line Numbers
  1. dim roll(3)as string
  2. roll(0) = "Yellow"
  3. roll(1)= "red"
  4. roll(2)= "green"
So I want to display yellow,red and green in a label
how do you do it?

please help its really important
Mar 1 '17 #1
1 1024
Frinavale
9,735 Expert Mod 8TB
Loop through your array and add the value at that array position to a string.

Then set your label's text to the string that you have populated with the data from your array.

If you have multiple arrays, then loop through each array and add the string at each position in each array to the string.

Expand|Select|Wrap|Line Numbers
  1. Dim labelContent as String 'Will contain the data from the arrays
  2.  
  3. Dim roll(3) As String 'The first array
  4. roll(0) = "Yellow"
  5. roll(1)= "red"
  6. roll(2)= "green"
  7.  
  8. 'Populating the labelContent String variable with the
  9. 'data in the roll array
  10. For rollIndex As Integer = 0 To roll.Length - 1 
  11.   labelContent = labelContent + " " + roll(rollIndex)
  12. Next
  13.  
  14. Dim moreRolls(2) As String 'The second array
  15. moreRolls(0) = "Purple"
  16. moreRolls(1)= "Magenta"
  17.  
  18. 'Populating the labelContent String variable with the
  19. 'data in the moreRolls array
  20. For moreRollsIndex As Integer = 0 To moreRolls.Length - 1 
  21.   labelContent = labelContent + " " + moreRolls(moreRollsIndex)
  22. Next
  23.  
  24. 'Setting the label's text to the variable
  25. 'that contains the content we retrieved from the arrays
  26. myLabel.Text = labelContent
  27.  
Mar 1 '17 #2

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

Similar topics

5
by: Bob Achgill | last post by:
Label example: "See the dog run." I would like to be able to highlight a given word in the example label using another color than the rest of the words in the sentence and/or maybe underline...
5
by: Jean Christophe Avard | last post by:
Hi! I have a query that INNER JOIN's three other tables. All the relation are 1 to 1, except for one, where an Item can have more than one price. I have this query that work fine in MSDE Query...
1
by: kfc1976 | last post by:
Hello All and Advanced Thanks For Replying, OS: XP Pro IDE: Visual Studio 2005 ..net Framework: 2.0..... Problem: Getting An Error When trying to implement the following CallBack on a content...
1
by: chris_huh | last post by:
Using the Label Wezard you can easily make labels for all the records in the table, but is there a way to make just one. I have a form that shows the data from a single recordset and on that...
0
by: sonali | last post by:
I Have A Grid With Drop Down List As Template Column In Scrolling There Is some Problem Code Is As Follows: <style type="text/css"> .gridFixedHeader { background-color:white;...
3
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr +...
2
by: Bsnpr8 | last post by:
I need help guys, i have to many stuff to do, because i am in my last 2 weeks of the university, my last assignment is to do a spell checker in C++, i have an idea but nothing is coming out. I really...
3
by: Poornima | last post by:
Hello My requirement is ,when the user enters a task name in the display,i need to store the name only in one place in memory but use it for internal processing and display the names to the...
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: 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...
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.