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

Assign Names from text File to Chech Box Labels

I hope I can explain this.

VB.net Visual Studio 2005

What I need to do is take the names in a text file and read them into my application. That I have done and put them in an array but I don't want to write them to the console. Here it is in a module.

Module GetApplicationName
' Function Name: GetApplicationName()
' Purpose: To get the names of the applications that can be installed on the computers
' Created By: William J Barker
' Change Log:
' Date Created: 25 July 2007
' Modified:
Public Function GetApplicationName() As String
' error handling
Try
Dim sr As New StreamReader("../../Config/ApplicationsInstalled.txt")
Dim sLine As String = ""
Dim arrText As New ArrayList()

Do
sLine = sr.ReadLine()
If Not sLine Is Nothing Then
arrText.Add(sLine)
End If
Loop Until sLine Is Nothing
sr.Close()

For Each sLine In arrText
Console.WriteLine(sLine)
Next
Console.ReadLine()

Catch ex As Exception
MsgBox("Error occured in Module GetApplicationName. Method: GetApplicationName(). Error: " & ex.Message)
End Try
Return Nothing
End Function

End Module

now what I need to do is take each name in the array and assign it dynamically to a check box label. There needs to be one check box per name in the text file.

example
Word
Excel
Power Point
Access
Front Page
Dream Weaver

means 6 check boxes. I know this can be done by looping through the array and assigning the values but I have no idea where to start.

Thank you for your help
Coach Barker
Jul 25 '07 #1
4 1561
Plater
7,872 Expert 4TB
For each entry in the names array:
create a new checkbox object.
set the various attributes of that checkbox (size, name/id, location maybe)
set the .Text property of it to be the name held in the area
add it to your parent container (Probably like this.Controls.Add() )
Jul 25 '07 #2
For each entry in the names array:
create a new checkbox object.
set the various attributes of that checkbox (size, name/id, location maybe)
set the .Text property of it to be the name held in the area
add it to your parent container (Probably like this.Controls.Add() )

I know that is what I need to do, but how do I go about doing it. How do I access the array of names from my form?
Jul 25 '07 #3
Plater
7,872 Expert 4TB
I know that is what I need to do, but how do I go about doing it. How do I access the array of names from my form?
You already do it:
Expand|Select|Wrap|Line Numbers
  1. For Each sLine In arrText
  2. Console.WriteLine(sLine)
  3. Next
  4.  
Just loop through your list of names like that and do the creating/adding of checkboxes there.
Jul 25 '07 #4
You already do it:
Expand|Select|Wrap|Line Numbers
  1. For Each sLine In arrText
  2. Console.WriteLine(sLine)
  3. Next
  4.  
Just loop through your list of names like that and do the creating/adding of checkboxes there.
Would you be willing to give me an example?
Jul 25 '07 #5

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

Similar topics

27
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there...
2
by: Martin O'Rourke | last post by:
All, I am hoping someone might be able to put me out of my misery and let me know if it is possible or not to dervie the name of an element in a form, based on its associated label, only knowing...
4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
1
by: Steve | last post by:
I have looked through the newsgroup for an answer to this but haven't been able to find anything resembling my situation. What I want to do is relatively simple, I think. I have a crosstab...
2
by: Ralph | last post by:
I'm trying to import a range of cells from an Excel spreadsheet into a table in access. The first row contains column labels, but I cannot use those as my field names, both because of their format...
4
by: Leor Amikam | last post by:
I want to use a css element and apply it to all labels on a page with the "asp:label" tag. I defined a CSS class: ..cls1 { font-weight: bold; color: royalblue; font-family: Verdana;
20
by: Shawnk | last post by:
I would like to get the class INSTANCE name (not type name) of an 'object'. I can get the object (l_obj_ref.GetType()) and then get the (l_obj_typ.Name) for the class name. I there any way of...
24
by: djsdaddy | last post by:
Good Day to All, This is my first post to the scripts, and I'm glad to be part of a community of experts that can pull me out of the holes that I sometimes dig for myself. I am running XP and Access...
1
by: dazzler | last post by:
I have application which creates data table from loaded data, table cells are created using labels. I am trying to do following: when the mouse cursor is over the one label it will be highlighted...
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: 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...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.