Choose Any Item On A String List ?
Apr 3, 2011How do i set a label text to display any of the declared string list randomly.
CODE:
How do i set a label text to display any of the declared string list randomly.
CODE:
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?
I am trying to get each item in a list box into a string array. However, I keep getting an index error and I am not sure why. I am doing this so i can perform a LINQ on the array.
Error:InvalidArgument=Value of '16' is not valid for 'index'.Parameter name: index
[code]...
I have a list with a few items ( changes once in a while ) named itemlist
[Code]...
Does anyone know how to do this? I'm stuck on a boat right now out to sea(Navy) and don't have access to vb.NET, its in my berthing...
So someone clarify this code and see if it works?
Dim index As Integer = list.FindIndex(Function(value As String)
Return value(0) = "STRING HERE"
End Function)
solve the problem, I'm unbale to drag icon from tools, I guess I'm wrongly delete something., I already Unstall and install back stil facing same problem.
View 5 Repliesthere's a list-box with items, and say you want to modify an item in the middle of the list. You select that item and click "Modify" button and a new form appears with the previously selected item data from first form ready to be modified in a text-box. After modifying and clicking Ok the second form suppose to return that modified string to the first form and insert the modified string into the same spot instead of the originally selected item, so it looks like it was edited to the user.
View 2 RepliesFunction runs fine on the listbox until i use the btnUp_Lanemgr click event
throws an exception in function (below in bold) "Unable to cast object of type system.string to type namespace.myitem"
what i can do to make this work?
'Button moves selected listbox item up
Private Sub btnUp_Lanemgr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUp_Lanemgr.Click
[Code]....
I'm having issues with finding something in list, and removing the item, ignoring the case of characters in string.
The code goes:
Dim listItems As New List(Of String)
Dim pattern As String = "AbC"
Dim array() As String
array = {"ABC", "abc"}
listItems.AddRange(array)
Here I'd like to remove all items from listItems, that are abc, no matter what case single characters of item are, including mixed case items. So in this example, every items should be removed
listItems.Remove(listItems.Find(Function(r) r = pattern))
If I change pattern to match the case of item, then item #2 gets removed:
pattern = "abc"
listItems.Remove(listItems.Find(Function(r) r = pattern))
How can I find item in listItems, ignoring the case characters in pattern?
I have a list box on the form which functions as a copy/paste. When you copy something, it is automatically added to the list box as a "clipboard helper". Here is the problem,however: if the text is more than 1 line, the list box does not show all the text.It ends up looking messy.So getting back to my question, is it possible to make the list box item height for an item depending on the amount of lines that item contains?This is a one line sentence in the list box and should take up one line.This is a multi line sentence in the list box and should take up two lines for item height.
View 11 RepliesI have a problem with a combobox. I have a form (with information about clients) with textboxes binded to a dataview. One of the columns in the dataview contains a number that tells me what kind of client it is. I don't my users want that my users have to fill in a number in a textbox, but I want them to choose a item from a combobox. De selected value should be the value that is actually saved in the database.
This is my
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
VerbindingMaken()
cmd.Connection = cnnVraagbaak
cmd.CommandType = CommandType.StoredProcedure
[Code] .....
De Datasource is the information in my combobox. With Databindings I'm trying to bind it to my dataset (or view, that doesn't work either) with clients. Every time I get a NullReferenceExeption. The moment I remove the line cbo.DataSource = dsRelatie.Tables("Relatiesoort"), I don't get an error, but it doesn't work either.
That dataset is filled (I've checked) and also the derived view. The column Relatiesoort exists. What do I have to do to make it possible for my users to choose an item from a combobox and save the selected value to the underlying dataset?
I try to add .NET items in my ToolBox (choose items...) by browsing. When I click Open, I get this message:
"The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag."
I work with VB 2010 and Windows 7 - 64 bits
the below statment is right 100% but what i need is to change the word mobinil when the user choose another item from the combobox
cmd.CommandText = "select * from warehouse where mobinil ='" + ComboBox2.Text + "'".I thought that i can do the follwoing dim x as string x= here will be the item selected by user- and ofcourse i need it to be put instead of the word Mobinil
cmd.CommandText =
"select * from warehouse where x value ='" + ComboBox2.Text + "'" is that possible ?
I made a program to make a random name up from 2 textboxes on my program ( a firstname textbox and a lastname textbox). But the problem is that I'm just getting the names in order they were put in. I was using this code
Dim fname2 As String = fname.Lines(F)
Dim lname2 As String = lname.Lines(L)
and once it generated the name I would put
[code].....
I'm relearning VB.net just for fun, so consider me new at this. I'm trying to write a program where the user can input a list of names or numbers, and the program will randomly pick one of those names or numbers. So far, I can get it to randomly generate numbers based on what I put in the code, but I don't know what I should use for the user to input the data, and how to code it so that the program will pick from that data.
View 3 RepliesI want the Function to accept List(Of String), Array & String and similarly return List(Of String), Array & String respectively. The Function simply adds a string (month) to the input collection. I just want to use it for string, array and list with needing to think of conversions.
[Code]...
How can I display a color dialog with a list of known web colors for the user to choose?
E.g.
black
white
dimgray
gray
darkgray
silver
etc.
I need to display ALL web colors
Give me some kind of tutorial for using the FB API with VB.NET (2008). I tried installing the SDK, but the components don't show up in the toolbox nor in the 'Choose Items' List...
View 4 RepliesI'm having some difficulty with a sorted & grouped listbox in WPF vb.net 3.5 that has an items source bound to an ObservableCollection.
What I want to be able to do is to retrieve a piece of data from the ObservableCollection items source depending on what item in the listbox the user has selected.I've almost got it working but because the listbox is sorted it does not match the index of the items source.
[code]...
As I previously mentioned, because the lstBox is sorted and also grouped the index's don't match up.Does anyone know how I can get the correct information I want from the List Source depending on the selected item in the list box?
How someone would select an item from a list box and click a button and have that item go into another listbox with it's price? I seem to be stuck on this part.
Here's my code:
I want to select the first option from the first listbox and I want to put it into another listbox along with the price of that item on the same line in the listbox. I can't seem to figure out how to that.
Public Class Form1
Const dcmPRICE_STRESS As Decimal = CDec(595.0)
Const dcmPRICE_TIME_MANAGMENT As Decimal = 695
[CODE]...
my program downloads into a combobox every item(line) that is in a text file located on a server.
Every line in the text file ends with "a)" or with "g)".
Now I just want to make 3 radio buttons:
- one that will allow the download in the combobox only the item ending with "g)"
- one that will allow the download in the combobox only the item ending with "a)"
- one that will allow the download in the combobox of both (I already know how to do).
How can I do so?
To download the entire list in the combobox I do:
Dim List As String = client.DownloadString("http://mywebsite.com/mytextfile.txt)Dim lines As String() = List.Split(New String() {ControlChars.CrLf}, StringSplitOptions.RemoveEmptyEntries)ComboBox1.Items.Clear()
ComboBox1.Items.AddRange(lines)
I need more then 1 (MS-SQL) connection string/configuration, depending on the current running configuration (Development, Production, offline etc.)How could I declare these connection strings in advance (Proj.Settings) and tell the application which one to use without the need to compile the program.Using a command-line argument is an option but still unconvenient.I know .NET/ASP has an 'outside' non-comipied config file used by the application which you can modify.
View 3 Replieshow whould I go about deleteing an item from a listbox and it will select the next available item.you know like the treeview control selects the next node if you delete one.
View 2 RepliesPublic Class notifierMain
Public Class Contacts
Inherits List(Of row)
Public Sub New()
[code]....
When I debug this winforms application I get curType = "notifier.notifierMain+Contacts+row" I want to the Validate function to know it is in MyContacts. How do I do this?
I've been trying to feed a multi line textbox into a string array then check item by item if a string contains part of it.
[Code]...
i want to stop accepting form drop down listbox if certrain criteria is not met [code]how i can cancel the selection of drop down list?
View 3 Repliesi want to search item A (from a list of X items) in list B but i want to get the item not found example Search ITEM A in LIST B if not found then return a print....if found continue with ITEM B..and so on.
View 5 RepliesI got an object of List<List<string>>I need to bring this into a ist<string>I have no idea how to do this with LINQ.
View 1 RepliesI have a List myList of MyObjects. Is it possible to check if myList contains a particular myObject based on a property of myObject in VB.NET? In C#, you'd something similar to this right:
myList.Exists(myObject => myObject.property1 == 3)
I have a List(Of MyObj), and I want to iterate through that list and compare each element to all other elements in the same list, excluding (if possible) the same element. I have a solution that works, but it's slow and uses double For loops. It may possibly have also summoned Cthulhu from his sleep. This below is a sanitized version of what I have:
Dim MyList As New List(Of MyObj)({Obj1, Obj2, Obj3, Obj4, Obj5, Obj6})
If MyList.Count > 0 Then
For i = 0 To (MyList.Count - 1) Step 1
[code]....