VB 2010 Create List Of Strings?
Oct 23, 2011
I'm new in this forum, and I'm a very very very basic user of the VB. How can I create a list of strings? I'm trying to make a chat with a robot. I put 2 labels. And my code is:
Dim mylist As New List(Of String)
mylist = "hello", "bye"
If Not Label1.Text = mylist Then
[code].....
View 2 Replies
ADVERTISEMENT
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
Jun 6, 2011
What would be the easiest way for me to create a list of words with a sequential number appended to the string. I need the string and amount of numbers to be a variable. For example:
network1
network2
network3
network4
[Code].....
View 2 Replies
Apr 4, 2011
How would I create a list of elements in VB.NET, save it to a .dat file, and make Ruby re-create such list (as an array) with such elements (they will be strings, booleans and integers)?
View 2 Replies
Oct 6, 2010
I'm trying to create a form that accepts names (or any strings) as input and stores them in a object. See attached form sample.Form Image:
Operations: ï Initially the NumericUpDown object on the form should be disabled.The user enters a value (string) in the textbox and clicks the Add button or presses the Enter key to activate that button.The application then stores that name in a List object, and displays the last entry in the Label underneath.The NumericUpDown should become enable after the first entry. The user should be able to move between all the values entered using NumericUpDown.
View 7 Replies
Jan 14, 2010
i have a list of strings
Public baseList As New List(Of String)
That I fill with a list of base words, but I now need to build a new list of words in which will contain a list of every combination of words in the baseList (given that each string is less than the maximum length i specify)For Example if baseList contains
horse
at
ten
football
and the maximum string length is set to 10, the finalList would contain
horse
horseat
horseten
horseatten
[code]....
how to build finalList from baseList?
View 2 Replies
Mar 16, 2012
it is possible to create objects from strings.Supose I have a class Matrix with a Row(x) property and an array S = {"One","Two"}. Can i do something like this in vb.net?
For i = 0 To 1Dim S(i) = New MatrixNext i
Dim P As String() = One.Row(0)
'Which gives me the first row of Matrix One How can I create objects similar to this?
View 3 Replies
Mar 3, 2012
I am trying to create an application that will randomly select 14 "stations" (strings) from a list of 33. My thinking is that I have a for/next loop that randomly selects a number between 1,33 which is then inputted into an array (arrnumber) I then want those random numbers to then be used to call the Station name which is saved in the second array, and then for the selected stations to be populated into a listbox (potentially by storing those names selected in a new array?)
Various people have suggested either using a list (of t) instead of arrays, or a Dictionary(?) or perhaps even a database, though I am not all that confident with VB to be able to know where the best place to start with that is. So if anyone can offer any advice, pointers as to how I can link my 2 arrays (I am pretty sure I know how to make the array populate a listbox) I would be very much obliged.
Public Class Form1
Dim Stationid() As String = {"Cardiovascular Examination", "Respiratory Examination", "Abdominal Examination", "Abdominal Examination with Stoma", "Groin and External Genitalia Examination", "Cranial Nerves Examination", "Arm Examination", "Leg Examination", "Parkinson`s Examination", "Cerebellar Examination", "Speech Examination", "Hand Examination", "Elbow Examination", "Shoulder
[code].....
View 5 Replies
Aug 5, 2010
I have a list of strings. For each string in that list, I want to prepend another string. I wrote a method to do it, but I was wondering if there was something already in .NET I could use to do this. It seems like something that could be built in, but I was not able to find anything.
Here is the method I wrote:
Private Function PrependToAllInList(ByRef inputList As List(Of String), ByRef prependString As String) As List(Of String)
Dim returnList As List(Of String) = New List(Of String)
For Each inputString As String In inputList
returnList.Add(String.Format("{0}{1}", prependString, inputString))
[code].....
It works, but I would rather use built in functions whenever possible.
View 5 Replies
Oct 16, 2009
I'm migrating from VB6 to VB.NET, in hence my questions below:
I have to write a function that returns array of strings.
How can I initiate it to empty array? I need it since I have to check if it's empty array after it returns from this function.
Is list of arrays better for this purpose? If I use a list - Is it empty when it firstly defined? How can I check it it's empty?
View 3 Replies
May 22, 2010
I want to create some type of list or collection. Each item on this list or collection will need contain A string name and a integer value. Something like
[Code]...
View 4 Replies
Jan 8, 2012
Is there an easy way to find a certain string within a string and then return the strings that you find as an array?I have written this:
Public Function FindStrings(ByVal strSourceString As String, ByVal strStartString As String, ByVal strEndString As String) As String()
Dim StringStartposition As Integer
Dim StringEndPosition As Integer
Dim Currentposition As Integer = 1
[Code]...
View 16 Replies
Jan 16, 2011
I have this string called time. It's value is in this format: HH:MM:SS The numbers change, but the format stays the same. I want to separtate the code into 3 strings Hour, Minutes, Seconds.
View 2 Replies
Feb 13, 2011
I need to create a program that when I click a button it shows a sentence (took it from a list) random. But after it have to delete the sentence from the list 'cause we dont want to read it again I don't know so much about VB so I'd like some help!
View 25 Replies
Mar 21, 2009
I would like to write a function GetHashCodeOfList() which returns a hashcode of a list of strings regardless of order. Given 2 lists with the same strings should return the same hashcode.
ArrayList list1 = new ArrayList()
list1.Add("String1");
list1.Add("String2");
[Code].....
I can first sort the list, then combine the sorted list into 1 long string and then call GetHashCode(). However sorting is a slow operation. I can get the hash of each individual string (by calling string.GetHashCode()) in the list, then multiplying all hashes and calling Mod UInt32.MaxValue. For Example: "String1".GetHashCode() * "String2".GetHashCode * ... MOD UInt32.MaxValue. But this results in a number overflow.
View 3 Replies
Feb 24, 2012
I have two List(Of String).Both Lists contain duplicate strings. I want to pick out all the strings which are contained in both the Lists. For example:
List1 ={"10X100","10X100","10X100","50X100","50X100","100X100"}
List2 ={"10X100","10X100","20X100","50X100","50X100","100X100","200X100"}
So, the result should be: List3={"10X100","10X100","50X100","50X100","100X100"}.How to do this?
View 7 Replies
Jun 8, 2011
Ok so what i'm trying to do is grab some strings from a list box and put them in an array so i can list them in a message box each index of the array on a new line
So it comes up like this
you ordered :
arrayindex1
arrayindex2
arrayindex3 and so on
View 2 Replies
Feb 13, 2011
This is my first time posting here although I have been lurking for quite some time. I'm stuck with a problem I have seen before and never solved: I have a long list (~23,000) of alphanumeric strings that I'm reading into a List(of String) from a text file, and then sorting. When I iterate through the list after sorting, it appears to be correctly sorted EXCEPT that the element that was originally at the beginning of the list is now at the end (and it should be somewhere in the middle after the sort)Here is a sample input:
PRE1-PRE2_00015648
PRE1-PRE2_00015649
PRE1-PRE2_00015650
[code].....
View 5 Replies
Apr 12, 2011
I'm trying to populate a List with a column of a DataTable in order to later convert it to a AutoCompleteStringCollection later. Is there a neater way to do it than the "good old" For Each?
Is there a way to use myDataTable.Rows.CopyTo for this task?
View 2 Replies
Mar 11, 2010
So I've got a list of strings in ListBox1 and I want to remove the last seven characters from each string in the list and write the output to an excel file...
View 3 Replies
Apr 27, 2010
The code below replaces if it finds a given string from the list of contractions with its equivelant from the list of word-contractions. E.g., if it finds 'll it will replace it with Will. The code words but whtn it comes to let's it will replace it with let is.
'remove panctuation and contractions first
Dim contractions As List(Of String) = New List(Of String)(New String() _
{"'ll", "'re", "'ve", "'m", "'d", "'s", "n't", "won't", "lets", "let's", "ikon of elkomenos", "ikon of crucifixion", "ikon of crist elkomenos", "Part A", "Part B", "renaissance style", "hagios nikolaos", "full wall fortification"})
[code]....
View 3 Replies
Oct 5, 2011
Update: I didn't make it clear but I meant this to be a question about where/how I would use a function to return a list of strings when I'm trying to just work with classes.I have a class called Account.
I have data access class called AccountDAO.I have various functions that return lists of objects like GetAllAccounts, GetAccountByID etc.I want to populate a drop down list with just the account names and nothing else. It's proving rather slow when using lists of objects and databinding them to the dropdownlist.
I feel like I should be using a simple "Select Account_Name From blah" type statement and returning a list of strings but I don't know how to work this into my class and data access class.
View 4 Replies
Feb 20, 2009
In .NET which data type do you use to store list of strings ?Currently I'm using List(Of String) because it's easier than Array to manage and add/remove stuff. I'm trying to understand what are the other options, when they become handy and when I should avoid List(Of String) usage.
View 4 Replies
Jun 10, 2009
I've build a list of Strings from files. The list itself is working fine (tried it by having ListBoxes and other controls loading its items from there just to make sure that this is not the issue). Now, I am using this list of strings to compare a Text in a TextBox1 while typing to determine if this TextBox1.Text already exists in the list. I am using the following code (where "s" stands for my List items):
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.TextLength < "1" Then
Button6.Enabled = False
ToolStripStatusLabel1.Image = My.Resources.pic_Add_Warning
ToolStripStatusLabel1.ForeColor = Color.Red
[Code] .....
View 10 Replies
Oct 22, 2010
I'm trying to create a number of strings based on one long string that i'm passing.
Basically this is an example of my long string
StrMain = AL123456 - PR123456 - RD123456 - LO123456
So in this case I want to create 4 separate strings.
Str1 = AL123456
Str2 = PR123456
Str3 = RD123456
Str4 = LO123456
But there isn't always that many or there may be more so I need to count how many - there are and with that then create the amount strings needed.
View 3 Replies
Oct 1, 2010
I'm having issues with returning a list of strings of the .Value of a Linq query:
Dim details = <Details>
<Vector size="5">
<Item>Syntactic Structures</Item>
<Item>Introduction</Item>
<Item>The Independence of Grammar</Item>
[Code]...
Is correct in that it returns the list of XElements I want (items 1 - 4, base 0), but I really just need a list of strings for the .Value of those XElements. Maybe I'm just dense here, but anything I've tried in the chapterTitles query isn't working (appending with .ToList.ToString, etc.). details.<Vector>.<Item>.Skip(1).Take(4).Value just returns the first XElement's value.
View 1 Replies
Oct 31, 2008
The following code loops through files in a directory as strings using FilePath.
[Code]...
View 2 Replies
Jun 22, 2010
I have a specialized string dictionary of (string, string) (_RulesAndTheirDescriptions) that contains the name (key) and description (value) of methods in a given class. I currently do the following query to search for a match on the key or value and then bind that to a grid.
[Code]...
View 1 Replies
Jun 12, 2011
I have a problem finding strings that do not exist in a column in a database. I am going to use linq but its more the 'way' of doing I am concerned with.
I have strings like;
MEAL
GPST
EXLEG
EXLG ...etc
I need to find records that does not have this list of strings in, so for example DBML BUT sometimes I can have the string MEALDBML, or more concatenated. So this is a known string of MEAL and unknown string of DBML. I would then want to see that record. I do not know the unknown strings up front, so its a case of feeding in the strings I know are ok, and finding one that are outside that list. I was also thinking of regex?
View 1 Replies
Aug 15, 2011
I have inherited a database that is moving to the web. Problem is that some of the string fields have html characters....
One example is....
"" without the quotes, IT WON'T SHOW UP IN HERE EITHER, trying something else. At any rate it has < and the > signs with text in the middle.
How can I escape any possible combination of html references.
SelectCommand="usp_getSingleStringData" SelectCommandType="StoredProcedure"
<SelectParameters>
<asp:SessionParameter Name="shrtText" SessionField="shrtText" Type="String" />
[Code]....
View 2 Replies