Store Two Related Numbers In A List?
Sep 21, 2010
Is it possible to store two related numbers in a list and then check them if the are exist in the list?ere is an example of what I did to achieve the above:
Dim CounterConnections, FromN, ToN As Integer
Dim ConnectionsList As New List(Of Integer)
Dim Myrandom As New Random
[code]....
The above code generate two random numbers and store the in a list. I am adding the two numbers to be one so that I can check if they exist in the list.e.g. if the FromN = 7 and ToN = 11 then the list will consist of :
711 and 117
a list to store 11 7 and 7 11 which is capable to be checked later if some some numbers are exists.
View 3 Replies
ADVERTISEMENT
Feb 19, 2009
i know that integer is a variable to store whole numbers and that a string is a varialbe used to store any text, but what variable type would you use to store a number that has decimals?
View 7 Replies
Jan 5, 2010
What's your list of blogs for anything asp.net and vb.net related. I know for instance Scott Gu's stuff is the first on the rank for asp.net.I'm trying to compile a list of 'good' stuff that will teach me things as I read, the more I gather the better, this way I'll get several posts a day, as most blogs post only once a week if that.jsut to list some of my favs, scottgu & phill haack... although he talks too much about his baby!
View 3 Replies
Aug 16, 2009
So how would I use .next (random numbers) to randomly select something from a list of numbers but it can't repeat the number?I could do:
dim num as integer
dim r as new random
num = r.next(1,5)
if num = 1 then
elseif num = 2 then
etc.
That wouldn't work because it would repeat.If I donwload someone's game can I disect it in VS? :0 I tried going to open project, then I went to the folder and clicked open. It brought me inside of the folder so I tried to open the game but there is no form1 there. It says the games name then .exe in the explorer-like thing in the top right?Also, how would I have a value or something in a label and access it from a button.
Example:This is in a label.
Dim number as Integer
number = 0
Then in the button do
Label.number = 0
How would I do something like that? I want to use that a lot as I did in a different language.
View 6 Replies
Jun 11, 2011
I have a table being imported into my VB application that has 3 columns. I have written code to import the table, and have written code to display on the first column (country) in a list view.
What I want to do now is have the user select / highlight an item in the list view, and have the third column (currency) related to that selected country appear in a text box when a button is clicked.
Here's the code I've written that successfully imports the data and displays the first column:
Private Sub frmCountry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dataCountry As New DataTable()
[Code]...
Should I perhaps use something other than a list view?
View 3 Replies
Jan 1, 2011
I have a table being imported into my VB application that has 3 columns. I have written code to import the table, and have written code to display on the first column (country) in a list view.What I want to do now is have the user select / highlight an item in the list view, and have the third column (currency) related to that selected country appear in a text box when a button is clicked.Here's the code I've written that successfully imports the data and displays the first column:
code
Private Sub frmCountry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[code].....
View 2 Replies
Feb 3, 2010
I have stores some numbers as strings and also some non-numbers as strings in an array. How do I find and store the numbers in one array and non numbers in another array?
View 9 Replies
Sep 1, 2011
Am new to programming and i would like your help to this question. [b][color="Red"]Write a declaration statement of an array of integers to store 15 numbers. Initialise the first 5 values.
When I open the Visual Studio 2005 I don't see the template i.e. Win32 Applications, C++
View 11 Replies
Aug 1, 2009
I currently have a list of words in a text file sorted in to alphabetical order and put into lower case, but I would like to be able to also display the line numbers on which these words are associated with.. but only one instance of.
For example,
"This is a random text
file that I
have just made
up this second"
[Code].....
As you can see above, I would like to show that "this" for example appears on line 1 and 4. Hopefully tabbed so that it keeps a nice look to it.
View 1 Replies
Jan 22, 2010
I need some help with to make a messages system. I build a form with display a message code and the message.
Example : 0000001 : Not connected to network
The problem is that i want to store in a central place where the numbers and the message will be stored in the code. I was thinking about a array to store the date.
View 3 Replies
Jun 15, 2009
I'm looking for a way to take seven 2 digit numbers & combine them into one number to store in a database.The numbers represent hours for each day of the week & I only have one field to store them in. Then I need to be able to take the stored number & decode it back into the original seven numbers. Anyone have any clever ideas how I can do this?
View 6 Replies
Nov 23, 2010
Right so my generator is working, but I now want to take the numbers that it generates and add them to a list of generated numbers. So you can monitor what numbers have been generated. then ideally a way to exclude these numbers from being generated again.
[Code]...
View 34 Replies
Mar 22, 2012
I am coding a program that will allow the user to input 5 payrolls for Store 1, Store 2, and Store 3. The total of the 5 payrolls are then added together and shown in the respective Store's labels. A total label is also there to add up all the totals into one number. The numbers in the label must be in currency form. My problem is the numbers don't add correctly when I hit calculate. The first two numbers add together, but then after that the number just seems to subtract a random amount.
So far I have this --
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
[CODE[...
View 14 Replies
Aug 17, 2010
I have a set of points. The connections among them areenerated. How can Draw lines between theconnected points?In the example below, Plist is the connection list among them. How can I store points to PList so that it draw lines?
Public Class Form1
Dim Matt(7, 7) As Integer
Dim NumberofConnections As Integer
[code].....
View 4 Replies
Jun 23, 2011
I just wondering if Visual Basic.NET and VB6 can do these examples.I have use python before and i will take some examples.Save numbers to a list and add
Quote:
this_is_a_list=[1,2,35,4564,532,2454,3404,3,455,2,1]
x = len(this_is_a_list)
this_is_a_list.insert(10, x)
len is a function who count how long a list is. This list is 11 numbers long. I will now insert/add number 10 after the last number. The first number has the place 0. The second number has the place 1.Can VB.net do that? Check how long a list is?Delete a list?
View 9 Replies
Jun 7, 2012
I'm trying to store a bunch of integers into a list. I need to be able to find a integer in the list, and change it somehow. I've tried an array, but it wont let me change the values?
View 7 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
May 24, 2012
I have a WPF form that takes a list of objects that have locations and sizes and plots them on the canvas. I'm currently trying to implement an undo button that will throw out all the changes that have been made to the positions of the objects and revert back to the original collection that was retrieved when the form loaded.
As it stands now I go out to the database on the load of the form and get all the objects that will need to be displayed then assign the list that is returned to two seperate collections. The problem that comes up is that the two collections are actually pointers to the original collection and whenever one is changed the changes are reflected in the second collection.
Is it possible to copy a list of objects so that changes made to one collection won't affect the secondary collection?
So far I've tried simply using the assignment operator, passing the source collection into a function byval and scrolling through each element of the list manually adding it to the second collection and using linq to get all the objects from the original list and pushing the results to a separate temporary list and assigning the second collection to the temporary list.
I feel like I'm overcomplicating the issue but almost all the places I've come across while googling say that this behavior is by design, which I understand but it seems like this would be a fairly common idea.
View 3 Replies
Sep 8, 2009
How to store the state of my check box list tick boxes accross the page life cycle? Here I have a unbound checkbox list control where values comes from xml file. How to retain the state? Moreover, when I click on Next button to the new page and comeback state is retained. But when I click on the back button and come to the same page state is not retained.
Protected Sub chkBx_SR_wu_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkBx_SR_wu.SelectedIndexChanged
Dim i As Integer
i = 0
Try
For i = 0 To chkBx_SR_wu.Items.Count - 1
[Code] .....
View 4 Replies
Dec 2, 2010
I have a list of files and all of them have a different size. I need to upload them in chunks of 250Kb (or less if it's a small file or if it's the last chunk of a file).What I would like to do is read a bunch of chunks (lets say 15 chunks), in a separate thread, and then store the chunks of data in some sort of list. This list must be available to other threads.
An upload thread (I don't need help with uploading itself) takes the first chunk from the list and marks the chunk as "currently being uploaded". When the chunk has been fully uploaded, then the chunk is removed from the list. A second upload thread takes the next available chunk in the list that has not been set to "currently being uploaded", etc. There are a total of 10 upload threads working at the same time.
As soon as a chunk is removed from the list, then a new chunk of data is read and added to the list.Does anybody know what kind of list I need or how I should do something like this? I don't expect people to write out the code for me, but I have no idea where to start with this.
View 4 Replies
Nov 30, 2010
I have a .txt file i want to read that has states by abbreviation and states by name. In that text file some are territories and some are states.
I want to read from that file and put the abbreviations into one structure array and the states into another structure array.
I then want to lookup up the states by abbreviation or state name. The lookup will simply be selected by a radio button which will flag either the states full name array, or the abbreviation array.
all I have is the structures created:
Public Class Form1
Structure Lookup
Dim Abbreviation As String
[Code]....
How can I read from the .txt file and store into an array
View 3 Replies
May 17, 2011
I have a string with xml data.Dim appManifest As String = New System.IO.StreamReader(Application.GetResourceStream(New System.Windows.Resources.StreamResourceInfo(e.Result, Nothing), New Uri("AppManifest.xaml", UriKind.Relative)).Stream).ReadToEnd()
[Code]...
View 2 Replies
May 29, 2009
i want to keep only the last 10 numbers in a List.
The list is declared as: Dim LastPlayed As New List(Of Integer)
I then Add several Items, each time checking LastPlayed.Count is no bigger than 10.
If it is, i only want to keep the 10 most recent numbers.
View 7 Replies
May 15, 2010
the dropdown list is showing data from database, but how to retrieve the selected value and store it in a session variable??
View 1 Replies
Nov 1, 2010
VS2010
VB
I would like to be able to add every combination of a list of numbers to determine which combinations equal a specific result.
Simple Example:
List: 2, 4, 6
Result: 10
How many and which combinations of numbers result in the number 10? The correct anwser is only one which is 4 + 6 = 10. The example is simple but the actual list may contain as many as 10 - 15 decimal numbers.
I have thought of the following as a possible way of checking each combination by using binary:
- There are 3 total number so the possible combinations would be:
123 - Three numbers
000 - Add no numbers
001 - Add the last number
[Code].....
However, I don't know how to actually match up the bitwise bits to the numbers in the array to actually add. Example:
101 - I should check if 2 + 6 != 10 per the example above so this wouldn't satisfy the result... does this make sense? The answer would be 4 + 6 = 10.
how to check and add all combinations from a list of numbers to determine if the result is a specific number?
View 2 Replies
Sep 28, 2010
Is there a way of adding the values 1-15 to an asp dropdownlist without having to do each one individually... I currently have:
[Code]...
View 6 Replies
Feb 16, 2012
I am working on a project where i need to get the average of 6 numbers i enter in a ListBox. There is one ListBox, one button to get the average, and one label where the average is displayed. i need to use an array and I am using the Visual Basics Programming but i dont think it is that big of a difference.
View 5 Replies
Jul 16, 2010
I'm trying to generate a text file that contains a list of numbers.This is what i have :
Dim startint As Integer
Dim endint As Integer
startint = TextBox1.Text
[code]....
View 3 Replies
Jan 28, 2011
Can I have a List containing one string and two numbers? Or I can only have one type of element?
View 3 Replies
May 4, 2010
Need to calculate Average Plan Duration for the 3 Shipment TypesSo far i haveQuote:
'CALCULATING AVERAGE DURATION FOR STANDARD
Dim iAverage As Integer
Dim iAvgDuration As Integer
[code]....
I uses the information from the list boxes, (lbShipmentDuration) and (lbShipmentMethod) to calcualte the average Duration for each Shipment Type.
View 19 Replies