Create An Array Of Points?
Oct 2, 2009I'm trying to create an array of Points but can't seem to get it right.
I can create an array of Integers just fine.
Dim MyArray() as Integer = {1,2,3,4,5}
I'm trying to create an array of Points but can't seem to get it right.
I can create an array of Integers just fine.
Dim MyArray() as Integer = {1,2,3,4,5}
is there a way to offset the points in a polygon without having to change each one individually the points are in an array
View 2 Replieshow can i sort an array of points...? elements added out of sequence causing wrong shapes with e.graphics.drawlines.
View 12 RepliesI'm trying to generate a list of random points of a 2d array.
ie
(1,0)
(2,1)
(1,2)
(0,0)
(0,1)
....
I need to process each array location, but I would like it to be in a random order.
how can i inflate an array of points which describe a polygon?
View 1 RepliesI have an global array of points that i want to plot in VB. say X and Y points, and typically they have values of +/-12000. Now I've not done graphics work for a long time and when I did, I used OpenGL with C. Now I need a GUI i'm using VB 2008. Firstly, what's the best method of rendering the array of points? should I use some port of OpenGL? GDI? or what?
Secondly, can I simply print to perhaps a Panel on hit of a button? Thirdly, do I have to place any line drwing code in an "OnPaint" event handler? Finally (for now) if my array represents points in a space much larger than the painting surface, how would I scale and scroll the final image within the the proposed Panel? I look forward to your advice.
I've rewritten my program so it would be more .net friendly (meaning I try to draw in picturebox.Paint event).
I try to use DrawLines using array of points, which are added by user one by one, but I can't figure out how to force my program to only use points that have been set by user and not the whole array.
When I call DrawLines pointing at my array of eg. 10 points and only 5 had been set, I end up with a nice set of lines with the last going to the upper left corner (0,0) and supposedly staying there for 4 more points, which is unacceptable.
I think of using ReDim Preserve each time, but I am not sure if it is the most efficient way to do this.
Anyone can think of something more elegant before I implement this redim monstrosity?
I am wanting to create a rectangle for two points (vector). I need a function that takes two points and a length and calculates a perpendicular point from line (vector) AB, to a given length.
I found this code, however it doesn't seem to work.
[Code]...
How to make back-up and restore point? what I want to happen is when I click the button back-up. It will generate a back-up of database in access on the current date. And if I click the button restore. the system will restore the last back-up point. So that when there is a file accidentally deleted, the system can retrieve it again.
View 1 Repliescurrently i dont have any code to show but i am curently creating an application on a windows mobile 5 device and wondered how i can plot a route manually....ie what i want to be able to do is use the stylus to touch somewhere on the screen and plot that as point A, then touch the screen somewhere else and plot that as Point B (in some sort of database) so that i can review that route afterwards
View 1 RepliesI have an array of type Double() (1 x n) that I am trying to quickly plot on a graph I've already set up. The only thing I want/need to do is take my array and store it as data points (y-axis values) in the series I already have. What's the best way to do this? Also, will the data points that are plotted change as my array changes, and if not, how would I replot those new points and get rid of the old points?
View 1 RepliesI am creating a points system for a game, this is the code I have but it isn't working as I want it to.
Dim intScore As Integer = 10
Dim intNumOfGames As Integer = 0
intNumOfGames += 1
intScore = intScore - 2
The user will start will a score of 10, but everytime they click the button the user should lose 2 points off the score. But my code above that doesn't happen, when the user clicks the button it only happens once leaving the user with 8 points throughout the game.
In need of some desperate help. Has anyone had any experience with a software product called Pres? The programme provides a function (userhook) that can run externally created dll's as the programme offers no COM support. The basic requirements for the dll are as follow.
1, The dll requires a public function named UserInstruction
2, The UserInstruction must have 5 parameters. The first and second of type long, the third a double array and the fourth and fifth parameters required type is a string.
This all seems pretty simple. But as .NET doesnt support exporting functions within a DLL to allow direct public access to the function through third party software it becomes tricky. After doing some research it seems as though this isn't possible in .NET. The only way I can see to do this is to convert the dll to Intermediate Language and play around with it once this is converted and then convert the IL code back to a DLL. I found this on the following site [URL]..After trying this when I try to use the DLL via Pres I am still getting no joy.
how can i get the points which make a polygon from a region which was derived from the polygon's points?
View 1 RepliesThis was an experiment to see if I could create a fake array using generics instead of using an array. I decided to try it, because I may use it if I find any advantages to using it over an array. it works, I am just asking for a second or third opinion, have I screwed anything up, or is there an easier way to accomplish this? If I use it, it will be for a 2D game I am creating, and is used to draw the 2D screen graphics, placing an image based on what image identifier is located at what coordinates. The value stored in the fake array is an integer that disignates the graphic to draw and whether it is passible or not, i.e. 0 = a floor image, 501 = a wall image that is impassible (any image number > 500 is impassable) The Class definition:
[Code]...
I want to create an array of an array (or arraylist of an arraylist) to hold strings.I want to fill an array1 with string values Then add this array to array2. - but only taking up 1 row in array2 e.g something like array2(index)=array1 Then clear array1 then loop through this again with different data, and add it to the array2.so will end up with something like
array2(0)... contains a collection of array1 data
array2(1)... contains a collection of different array1 data
.. and so on
i think i need to make new instances of array1 each loop, but not sure.I dont mind if it uses arrays, or arraylists, or lists, or structure of arrayslists?
Ive tried making my own array, and ive practically completed it, but it doesnt seem to work. The issue seems to be that it cant convert string to type double. but do not know how to fix the error.[code]...
View 11 RepliesI just created a "Usercontrol" in WINFORMS- it just contains 1-Button with some style.And i need to use the same as array(10) and load it to a form.
Ex:Dim myButton() As Button = New ucSpecialButton(dataset4Category(i).Tables(0).Rows.Count - 1) {}
Here my usercontrol name is ucSpecialButton can we create a ONE-Dimensional Array of a WINFORM usercontrol.?
I need help creating a batch of Grand Totals each time enter my value and click Calculate.The code below gives me my Grand Total, now I would like to enter a new set of values and store the previous amount(s) until I'm ready to populate them in a Message Box.
Dim sum As Decimal = 0
For Each total As Decimal In totals
sum += total[code]....
It was so simple in VB6 but I don't know how to approach it in VB2010. I've looked the internet but each site seems to have a different solution and masses of code for something that could be done in a few lines in VB6.Here is the code I want to use. How do I go about creating a control array of 100 picture boxes pic(1) up to pic(100)?
Code:
For y = 0 To 9
For x = 1 To 10
tempObject = (Mid(StrRow(y), x, 1))
[code]....
I need to create an array of decimals by getting input from the user. I know how to create one of random numbers but do not know how to get the input from a user through a text box to a list box.
View 1 RepliesPossible Duplicate:VB.Net Initialising an array on the fly
This maybe a stupid question, but its got me exasperated. How do I declare a new array inline? Is this possible? I've tried all of the following and they all don't work.[code]...
The more I read my book the more confused I get, as the programming example is not even close to what this assignment is I am to modify my existing project to keep track of an order in an array.
View 1 RepliesUsing VB2010, I would like to create an array of buttons and a sub procedure that when I send the index number, I will be able to change the text on the specific button.
Dim myBtn as button={button1, button2, button3}
private sub GetCaption (ByVal x as integer)
myBtn(x).text="OK" 'If x=2 I should execute button3.text="OK"
[code]....
call GetCaption(2) 'Call the sub and change the text on button2 to say OK.How do I make it work?
how to creat an array of forms : i tried this thing out:
View 11 RepliesI want to create an array of tcpclient 1 to 5. i know it can be done by arralist but how i will add array of socket in arraylist and send/receive data.
View 5 RepliesI have this current problem I created user control with timer and use it on my form. My problem is how can I create array timer bound to user control.
example my user control name is uc_project my timer g_tmr
On my main form
uc_project.g_tmr.Enabled = true working fine
But how to make uc_project.g_tmr(index).enabled = true to create multiple timer.
How do i create an array using a picture box....i wants to create an array for 10 picture boxes and how to declare and define it....
View 3 Replieshow do i create an array with known values for example this is what i want to do
Quote:
dim str as array
str=("!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "~", "_", "+", "|", ":", "<", ">", """", "`", "", ";", "'", ",", ".", "/", "-", "=", "{", "}", "[", "]", "?")
but that doesnt work in vb 2008.so how can it be done without using a for loop and entering each value in step by step Also what exactly does
Quote:
lpText = New String(Chr(0), 100)
I'm writing a ray tracing program that uses snell's law to trace rays through a system of lenses to examine abberations in a given design.I have a class called lens, which holds variables for example, name of the lens, description, number of elements.I want to be able to have a sub class or array within lens (or some other way to manage this data).I wont know what number of elements is until run time.
So I would need to define the array at run time.Part of the idea of my program is randomly generate lens elements within given rules (as in a massive lot), keep the top designs and continually refine them by making billions of micro adjustments to the variables that define the lens etc, which I can pick up later on as it'll save the database/variables.For example, say Lens(63).NumberOfElements = 6.
I want to be able to access Lens(63).Element(3).Radius1 Etc, there will be a bunch of variables under Element, such as Radius1, Radius2, refractive index, horizontal diameter, vertical diameter, and spacing between the next element if it isnt the first.
And Lens(70) may only have 4 elements etc. How can I define a different array size like that in the class under different parent array indexes at run time?