Finding Squares In An Array?
Oct 9, 2010
I have an 2 dimensional array that is full of 1s and 0s such as
0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1 0 0
0 0 1 0 0 0 0 1 0 0
[Code]......
Also the array must be able to have more than one square.
View 1 Replies
ADVERTISEMENT
Jan 7, 2009
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.ComponentModel
Imports System.Drawing
[Code]...
View 1 Replies
May 10, 2009
I have some code that generates 15 random numbers between 1 and 100 and prints the 15 numbers in a listbox. I want to be able to find the max and min numbers in that list. How would I go about finding those values? I'm new to VB so a solution involving basic string/array manipulation would be preferred.
View 2 Replies
Aug 21, 2011
find the first empty value on an array?Say I have a directory and will occasionally be adding and removing items from an array to represent this. How would I go about making a loop until the entry is empty. I've tried various things like if null and that sort of thing but none of them seem to work- the problem is I guess that this array value is empty and the system can't deal with it without throwing an error message.Creating an array of a set size from the start isn't an option as I've no idea how big the directory will ultimately be.
View 19 Replies
Dec 10, 2008
Say I have an array of doubles sorted from smallest to largest. What is the FASTEST way to find the closest value in the array that is LARGER/SMALLER than the search value if an identical value is not found.
Code:
dim myArray() as double = {1.245, 2.45, 3, 4.556, 5.4434}
'LARGER AND SMALLER SEARCH for 3 should obviously return 3 because its in the array.
'LARGER SEARCH for 2.46 should return 3 because it is the closest LARGER value
'SMALLER SEARCH for 2.46 should return 2.45 because it is the closest SMALLER value
I certainly can do this on my own, but I am looking for the fastest way.
View 3 Replies
Feb 15, 2012
I have a database which need to be assigned into array arr()(), e.g.
arr(0)(0) = aa arr(1)(0) = ab arr(2)(0) = aa
arr(0)(1) = bb arr(1)(1) = ba arr(2)(1) = ba
arr(0)(2) = cc arr(1)(2) = cc arr(2)(2) = cc
I need to find distinct / unique value in each arr(k)(0), arr(k)(1), arr(k)(2); where k=0..2. Then i need to insert the result into array cat as follows:
cat(0)(0) = {aa} cat(0)(1) = {ab}
cat(1)(0) = {bb} cat(1)(1) = {ba}
cat(2)(0) = {cc}
I've tried code below but it doesn't work. The assigning process into array arr()() from DB is OK. Problem only come up if I try to find the distinct value (If Not (cat(j).Contains(ds.Tables(0).Rows(i).Item(j))) ... End If).
For i = 0 To 2
list(i) = New Integer(3) {}
For j = 0 To 2
[Code].....
View 2 Replies
May 9, 2009
[wink]You'll notice i dim'd n as integer = 0...[/wink] hehe I need a bit of advice on how to find the largest number stored as data in an array. For example vote(0) = 6, and vote(3) = 12, and lets assume all the other vote(n) are less. How do I pick out the big one?
[Code]...
View 8 Replies
Feb 3, 2011
I am trying to find a set of missing values between an array and cell values from a DataGridView. The array is a set of numbers from 1 to a user-entered maximum number. For example, if the user enters 10, then the array will have the values 1,2,3,4,5,6,7,8,9,10. The rows in the DataGridView might have values such as 2,4,6,8. I want to create a second array that would have the values 1,3,5,7,9,10. I believe I need to loop through the array values and compare them to the row values in the DataGridView. But I'm stuck on the method of either adding or removing values (or doing nothing) to the second array as the array value loops through the DataGridView. logic or some VB Code that will produce the results I'm looking for?
View 8 Replies
Nov 14, 2011
Im trying to make an on access file scanner, YES I know that C++ is better, but this is a concept of thought, trying to challenge myself to see if its possible in vb.
Anyways, I have a list of Hex definitions, my question is, how can I index this list so I can access the definitions faster. A definition looks like this:
Eicar.Test.File.a=58354f2150254041505b345c505a583534285
The part after the equals sign is the HEX signature, while the first part is the name of the definition.
Basically what I am trying to do is index them somehow where I can scan faster, as I have over 60,000 definitions and I have to split each individual one in order to get the signature name. It takes about 45 seconds or so to scan a 500KB file. I need it to be WAY faster.
View 1 Replies
Jul 9, 2010
I have an array Newstr(20) When I fill it, I need to know how many of its indexes has been filled ? and find out the values.
View 3 Replies
Jul 15, 2010
Say I have a two dimensional array
[0] [1] [2]
[3] [4] [5]
[6] [7] [8]
Now suppose I want to get the position of the number 6
I know with a one-dimensional array i can use Array.indexOf() but what would my options be with 2-dimensional arrays?
View 3 Replies
Nov 8, 2009
I have an array with wild character at the end. I use the value in this array in Select statement. Some times the array has same values. I want only distinct values in the array before the select statment.
Code:
for i=0 to count
select * from tbl where item like ' " & itemname(i) & "'
next
I need distinct element in itemname array.
View 1 Replies
Nov 14, 2011
I am working on arrays and I am currently having trouble with searching and finding arrays. In this example, the user should be able to enter a Name, and it will output that person's stats.
Here is the text file (note, I should be able to go to this text file, add a few more names and the code should still work, which is why I am using loops,arrays,text files instead of if and else statements),
Kobe,29,6,4
Allen Iverson,28,7,4
Jason Kidd,12,10,9
So if the user enters Jason Kidd in the text box, this will display in another text box:
Jason Kidd averaged 12 points, 10 assist, and 9 rebounds.
[Code]...
All right now is the searching part. I really do know how to search for what the user entered and display the statement in a text box. I kind of have an idea of how to just get the name, but for it to get the name and then all the data for that name puzzles me even more.-I tried using .contain, indexof and few others.
I know to display the information in the text box will be something like:
textboxoutput.text = PlayerName & " averaged " & PlayerPoints & " points, " & PlayerAssist &" assist, and " PlayerRebounds " &" rebounds"
So basically, I want it to where the user can enter a basketball players name and display the values for that name.
View 4 Replies
Jan 19, 2010
Entered an 5 elements of an array so is has 4 index? I need to find the lowest and highest element of an array and their index position
Example: I enter 1 2 3 4 5
The output should be like this
The lowest is 1 and position of index is 0
The highest is 5 and position of index = 4
View 5 Replies
Apr 29, 2010
display squares of od numbers between 1 to 50?
View 1 Replies
Oct 30, 2011
[code]This colours the squares on the map, but I wish to have an outline between them so as to make it a grid. Also is there any way of getting a thicker border?
View 1 Replies
Feb 20, 2012
I'm retrieving data info from comments in a website. Everything is fine (I can show correctly the words with accents), but in most of the phrases it comes with a square: How can I remove it?
View 8 Replies
Jul 26, 2011
Is there a way I can resize 4 external application windows into 4 different blocks so they make up a 4x4 block that covers my screen?
View 6 Replies
May 12, 2008
I have been working on a checker game. So far I have code that allows all the white checkers to move properly. The only problem is that this code is about 5000 lines long. I am sure there is a quicker and easier way to do it.
Here is the code for one checker to move in all squares possible for it to go into:
elect Case str1
Case 1
If picCheckers1.Location.X < 271 And picCheckers1.Location.Y > 114 And Open5 = True Then
picCheckers1.Location = square5
str1 = 5
Open1 = True
[Code] .....
The case is the square that the checker is currently in. I also will attach a zip file of the game so that you can understand it more. There are no errors and everything is working fine but I am trying to find a quicker way to code that doesn't take another 5000 lines of code
Attached File(s)
The_Checkers_Game.zip (430.85K)
Number of downloads: 1266
View 2 Replies
Nov 4, 2009
I have this programming assignment to have a text box list all the squares and cubes from 1 to {$value} however when i run my subroutine only {$value} is displayed here is my code:
Private Sub btnCalc_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCalc.Click
If txtNumber.Text = String.Empty Then
MessageBox.Show("Enter a Number", "Can not Calcuate Squares and Cubes")
[code]....
View 4 Replies
Jan 18, 2010
I don't do much .Net programming, but I do have one that I maintain, so the answer to this may be obvious.
Setup:
Windows 7 Ultimate with All Language Packs Installed
Visual Studio 2008 Winforms VB.Net project.
I'm in the process of localizing this project, and when I'm making the Japanese version of the forms, the characters display as squares, though they render in my browser correctly. I'm guessing that this is because the default font does not have a glyph for those characters.So, my questions:
Are winforms UTF-8, or some other character encoding?
Is there a way to change the character encoding?
Should I change the font for the Japanese forms, or will Windows do it?
What's the general best practice here?
I want to know that I am copying the characters correctly into my forms, and I want to be able to test them.How can I do this?
Arial Unicode MS does have all the glyphs, but I wasn't using it, because it wasn't in the VS2008 list of fonts. I manually edited the font box to use it, but then Visual Studio throws the message, "Attempted to read or write protected memory. This is often an indication that other memory has been corrupted." I'm guessing that's because VS doesn't have permission to access that font for some reason. I go back to the default font, scary error message goes away.
Then, even when using Arial Unicode MS, the text renders as blocks in the forms titles.Same text renders correctly in labels.I think I want to use the default font, and let Windows handle it. I think I've read that everything from XP on will handle it. Windows 2000 won't, which is a shame, but what ever, I don't know what font I should use, and whatever font it is was excluded from VS.I don't know how to add it without getting lots of error messages about protected memory.Now the problem is, resizing the labels in the form, since the translated text is often larger.
Also, I don't have a support team to do this for me, but I could maybe install extra copies of Windows 7, and change to the Japanese language pack and try to run it.But that becomes a major pain.I thought I read that you could change the language while the application is running, but that doesn't seem to be true.MS docs talk about how to do this, but Windows 7 also tells you that you have to log out to change the language.MS Gothic seems to work, and it's part of VS 2008, but the title bar is still squares. That's really odd, since the same glyphs are in the winform.Is that because title bar fonts are set at a system level, and not the application level?
View 3 Replies
Mar 9, 2012
I wrote a vb.net program that can view the documents It uses a reader and decompresses the sql blob to an outputStream and displays the document after a Response.Flush.We sent the code and databases to another group to host this website themselves. They can run the website but when they view the documents the documents open with a page full of small squares.
View 1 Replies
May 12, 2012
I am making a CSS layout creator. You can create reziable/dragable sqares. And when you press a button it get the css code for it. How would i get the locations and size of each box? And then spit that all out in a rich text box?
View 22 Replies
Dec 15, 2010
I am making a game based on "Simon" where the computer creates a sequence and the user then has to then replicate it. To create and show the sequence I am generating random numbers between 1 and 4 then based on what numbers come out I change the image in a picture box to simulate coloured squares lighting up. The problem however that I think I am having is that the loop I made is executing too fast as all I see when I run the program is the last light in the sequence. For example is the sequence generated was 2341 all I see light up is square 1. I have stepped into the program and it goes through everything correctly so the only thing I can think of is that it runs too fast to see? [code]
View 2 Replies
Mar 2, 2009
i have a string array that i want to output to a text file. the array size is 10000. i fill the array starting from 0 with some strings. at the end, i only want to show the array from index 256 to the last array that is not empty (for eg. if the array is filled with data from 0 to 2000, i only want the text file to show the data from 256 to 2000 and ignore the remaining strings). Is there any function to do this?t i use is shown below
Dim myArray(10000) as string
Dim strArray As New System.IO.StreamWriter("c:List.txt")
strArray.WriteLine("{0,10}{1,30}", "Index", "Symbol")
[code].....
View 8 Replies
Mar 2, 2009
i have a string array that i want to output to a text file. the array size is 10000. i fill the array starting from 0 with some strings. at the end, i only want to show the array from index 256 to the last array that is not empty (for eg. if the array is filled with data from 0 to 2000, i only want the text file to show the data from 256 to 2000 and ignore the remaining strings). Is there any function to do this? i am using visual basic express 2008. The code that i use is shown below
[Code]...
View 2 Replies
Jun 19, 2011
I have an array of people stored in a custom structure array... how can i copy this array to a temp array so that the temp array has all the same values as the original custom array?
View 4 Replies
Jul 28, 2010
I am trying to create the following program Store in a 1d array a set of 5 place names and in a 2d array the distances between the places. Ensure that the order of the places is the same in both arrays. When the names are places are input the distance between them is displayed. If they are not both in the table a suitable message is displayed
Dim town(1 To 5) As String
Dim Dist(1 To 5, 1 To 5) As Integer
Dim First As Integer
[CODE]......................
I think the best way forward is pass a parameter to the function findnumber.
View 1 Replies
Mar 16, 2011
My EmpTable is in SQLserver & Data entry using Visual Basic 2010 "List format" on Windows form.Sir my requirement, if I enter (Date of Birth) in DOB column the Age should display on the same form in Textbox.
View 3 Replies
Jun 7, 2011
In my vb.net winform application, I am moving the file from one folder to another. I need to store the datetimevalue when the transfer has been done. Later I need to show this DateTime value in my Grid. Here is the code i have written, but not able to store the datetime value.
[Code]...
View 2 Replies