Put Some Pictureboxes In An Array?

Jan 20, 2009

i'm making a program and a need to put some pictureboxes in an array, when i try debugging it gives me an error, i can't figure out what its having trouble with :S

Public Class Form1
Dim itemArrayXO() As Color = {picXO1.BackColor, picXO2.BackColor}
Public Sub XO_Check(ByVal x As Integer)

[Code].....

(you may notice there are only 2 pictures in there, thats because im trying to get it to work before i go typing it all out)

View 2 Replies


ADVERTISEMENT

PictureBoxes In Collection Or Array?

Jan 7, 2010

I have 5 pictureboxes on my form and would like to but then in a collection or array to use them in a loop. I would like to use the FOR EACH loop... but how..
Th pictureboxes are placed in a Table. Here is my code so far.

Dim TableHeaders As String() = {"PERIOD", "GRADE", "SUBJECTS", "POSSIBLE ATTENDANCE", "ACTUAL ATTENDANCE", "% ATTENDANCE", "DISTICTIONS", "NUMBER ENROLLED", "STUDENTS WRITTEN", "STUD PASSED", "% RETAINING", "% PASSED", "TERM MARK", "NAT AVERAGE"}

[Code]...
It says that PictureBox is a type and can not be used as an expression, so how do i do it?

View 6 Replies

Fit Array Of Pictureboxes Within A Panel On A Form?

Apr 19, 2012

I'm making a game which involves putting an array of picture boxes in a panel. I can see the picture boxes, but some are cut off where the panel ends. I have also used:

My_PictureBox(Row, Column).SizeMode = PictureBoxSizeMode.StretchImage

View 6 Replies

Making An Array Of Pictureboxes At Runtime?

May 22, 2010

im making an array of pictureboxes at runtime:

Dim picEnemy(9) As PictureBox
Dim enemysprite As Image
enemysprite = Image.FromFile("....gif")

[Code]....

i get the error:Object reference not set to an instance of an object.

now i know the error would be solved if i had:

dim picEnemy as New Picturebox, but i cant since its an array

View 3 Replies

Use MouseEnter Event With An Array Of PictureBoxes?

Dec 2, 2011

I have text for ToolStripStatusLabel1.Text in a file which is read into an array.

There is an array of PictureBoxes, which are used for the MouseEnter event.

I am trying to display different text in the status when the mouse is over a certain image. In the code below, the Array.IndexOf() generates "Index was outside the bounds of the array.". The commented line will change the text when I change the Index but, it changes it for all images.

View 2 Replies

How To Make And Place PictureBoxes On Screen With Array

Oct 17, 2010

How to place units and their men on the form but I cant seem to get this array to work. It has multiple errors in it.

Dim pic(calctroops()) As New PictureBox
Dim z As Integer = 15
For i = 0 To Form3.orcunits
For x = 1 To Form3.orc(orcunits)
z = z + 15
pic(i).Location = New Point(Orc1.x + z, Orc1.y)
pic(i).BackColor = Color.Green
Me.Controls.Add(pic(i))
Next x
Next i

View 2 Replies

VB 2005 - Multiple PictureBoxes And Setting Up Control Array

Sep 7, 2005

I have a VB2005 project that displays 16 pictureboxes in a 4x4 grid which display CD album covers. In VB6 I could set up a control array i.e. picCD(0) to picCD(15), which made drawing the CD covers a snap. How do I accomplish this in VB2005?

It seems extremely cumbersome to have code like: If Len(path(0)) < 1 Then
If Not IsNothing(PictureBox1.Image) Then
PictureBox1.Image.Dispose()
PictureBox1.Image = Nothing
End If
[Code] .....

View 5 Replies

Adding Proper Number Of Pictureboxes To Array Control [VB 2008]

Aug 10, 2009

My application has no static number of pictureboxes. I want to add picturebox to array control.

[Code]...

View 4 Replies

Pictureboxes And Ovals, Get Ovals To Be In Front Of Pictureboxes?

Jun 20, 2012

I am creating a photo hunt game for grades 6-9 in summer camp. I want them to alter an image in paint then create two picture boxes. I want to put in ovals with no fill color to mark the differences in the picture but VB.net won't let me send the images behind the ovals.

View 5 Replies

Drawing The New Pictureboxes?

Jun 16, 2009

what i'm trying to do is make sort of a picturebox game. I have a picturebox name p1 that i got to move with the arrow keys on the keyboard. What I was tryna do next was to have it so that whenever I pressed the spacebar on that a new picturebox would be created, originate from p1's location and then go up 5 pixels at a time. so here's my code that i tried;

Dim Loc As Point
Dim shot2 As New PictureBox
If e.KeyCode = Windows.Forms.Keys.Space Then
shot2.Visible = True

[code].....

I have that under the keydown event by the way. So even thou vb didnt have conflicts with my code. But when I press the spacebar nothing happens.

View 3 Replies

Gap Between Pictureboxes In A FlowLayoutPanel

Jan 27, 2011

I want to create a chess table, and I've made one with a FlowLayoutPanel and 64 PictureBoxes but I have a little problem. After i add the PictureBoxes I hava a gap beetwen them and I don't want to have it, i've tried 2 posibilities but nothing, I will put an exemple from my code

Private Sub init_table()
Dim color As Integer = 0
Dim boundX = 0

[Code].....

View 2 Replies

Overlapping PictureBoxes?

Aug 20, 2009

I have a game where I want my character to go over the PictureBox but he goes under it. How can I fix this?

View 1 Replies

Pictureboxes Not Showing Up?

Dec 11, 2011

For counter As Integer = 0 To gamecontrol.unitlist.Count - 1
If gamecontrol.unitlist(counter).isAlive = True Then
'create picturebox if not already existing

[Code].....

View 1 Replies

Re-ordering Pictureboxes In .Net?

Jan 29, 2009

I am developing a Blackjack game in VB.Net using Visual Studio 2008. I have Picture boxes to display the players cards. The issue I have is that when the player chooses to hit , the third card stacks properly over the first two, but on the forth hit,the picturebox(which contains the forth card) appears under the third card. The same happens for the fourth , fifth, and sixth card . I have looked at the properties for the picturebox hoping there was some kind of index (similiar to zindex in css) to order the cards so they would would "stack" on top of one another but leaving the numbers of the cards visible, to no avail as I am here posting I have a screenie of the situation to better illuminate my struggle.

If you look at the picturebox with the 8 of diamonds card in it , everything is fine, but you will notice that the 10, 4, and 8 of clubs is underneath. I would like these cards to stack as the 4 of clubs, the 9 of diamonds and the 8 of diamond did.

View 4 Replies

Using Oop To Animate Pictureboxes?

Mar 18, 2012

I am haveing a big problem with object orientated programming I just can not seem to understand it fully I can use it for simple tasks but I am trying to use it to create enemys in my game that move automatically.I want to be able to put the moving logic in to a class and then apply it to as many pictureboxes that want in my game i also want the class to add enemys automatically. The enemys are cars and I have the moving logic but as I said am unable to figure out how to put it in a class and call it sucsesflly. If anyone could help me with this it would be very appriciated as this has been stressing me out for weeks.

[Code]...

View 14 Replies

Manipulating Pictureboxes Positions?

Dec 18, 2011

i'm creating a game like text twist. that when i press letter a, i need to determine which picturebox contains letter a and display it to different location. that also goes to the proceeding letter a's. for example, i have a jumbled letters "aamba". in my code, it only gets the first letter a and removes it form the screen, it's nowhere to be found. and it won't recognize that i still have other letter a's i'm pretty sure about the location that i set it to be placed.here is my

(it's kind of brute force i think)
ElseIf e.KeyChar = Chr(97) Then
counter1 = 0[code].....

View 7 Replies

Adding Multiple Pictureboxes?

Mar 8, 2012

A while back I made a brickbreaker game with out the bricks. Its a picturebox bouncing on the sides of the form and the whole goal is to keep it from hitting the bottom of the form. Now I'm fed up with that, I want to further myself by adding bricks that I can break and keep score. I have something I came up with, but it will only add 1 picturebox.

Dim pb As New PictureBox
Dim locX As Integer = 75
Dim locY As Integer = 100

[Code].....

I did wrap a try/catch inside the do until. My plan is to add one row, then reset my locX, finally move to a different row(locY) and do the same thing.

View 2 Replies

Can't Seem To Be Able To Find All Pictureboxes In A Form

Oct 24, 2010

The error is: Unable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.Forms.PictureBox'.[code]...

View 3 Replies

Controll Multiple Pictureboxes At Once?

Sep 5, 2009

I nedd to find a time saving way to controll multiple pictureboxes at once, sometimes 25-50 at once. They are numbered in consecutive order, PictureBox1, PictureBox2, ect. there are over 700 of them in this matrix. Is ther a shorter way of coding their hide, or show function? This is the only way I have to do it.

[Code]...

View 23 Replies

Creating Pictureboxes At Runtime?

Mar 5, 2009

im doing a project in which im basically trying to make an etch-a-sketch style program.

I am using a 5x5 pixel picture box as the 'cursor' and have made the program so that i can move the picture box with the arrow keys. I am currently trying to work out how to make a trail of identical picture boxes (from an array of picture boxes) appear wherever the cursor has been using this code

Case Keys.Left
CurrentLoc = New Point(PictureBox1.Location.X, PictureBox1.Location.Y)
If Not PictureBox1.Location.X - 5 < 0 Then

[Code]....

Basically, im trying to make a trail by moving the original picturebox and the inserting an identical picturebox in the original's previous position. However, the new identical ones do not display

View 3 Replies

Dragging Several Pictureboxes Around The Form?

Jul 16, 2009

the user has the option of dragging several pictureboxes around the form. when he lets go of the mouse, the picturebox will take on a new position on the form.

i would like to implement the following:

on mouseup, if the picturebox position is within some amount maybe 50 or 100 (i dont know what units VB.net) uses, i would like it to be dropped exactly in a defined position. sort of like if you play checkers on yahoo games, you dont have to place the piece exactly on the square only approximately.

View 1 Replies

Draw A Line Between Two Pictureboxes?

Oct 31, 2011

I am building a basic program for kg students,,I have a form with two sets of picture, 5 pictures at left and 5 pictures at right

names of pictures at left are

picEyeLeft
PicListenLeft
PicNoseLeft
PicHandLeft

[Code].....

View 20 Replies

Hide Multiple Pictureboxes At Once?

Oct 16, 2011

My code:

Case 1 To 9
txtPlanet.Text = "Mercury"
pl1.Show()

[Code]....

How do I make it so it does it like this: pl1.Show, pl2-9.Hide. If that isn't possible, what's the best solution to neaten the code?

View 3 Replies

How To Avoid Overlapping Of PictureBoxes

Jun 13, 2012

I am making an application in which number of pictureboxes created at runtime but they do not overlap to each other. I wrote a code bt its only for two pictureboxes.How can i do that for number of pictureboxes..

Public Class Form1
Dim pic1, pic2 As Rectangle
Dim drag, iscollided As Boolean
Dim mousex, mousey As Integer
Private Sub pic_Mousemove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
[Code] .....

View 1 Replies

How To Move Multiple Pictureboxes

Oct 31, 2009

how to move 5 picture boxes at the same time. Like making them bounce on the walls of the form and each other.

Here is my Code

Public Class Form2
Dim xSpeed, ySpeed As Integer
Dim iClicks As Integer

[Code]....

The problem is that the picture boxes do move but, they move at the same time. For example if Pb1 hits the left side of the form all of the other Picture Boxes will to.

View 2 Replies

Jerking Panels And Pictureboxes In WAF?

Feb 23, 2012

Im working to develop an application thats going to run on some not-so-good as performance PC's. The application is done in VB.NET and i encountered some obstacles during my work.

The idea of the application is to allow the users to slide through some pages when they click with the mouse and drag (while the left click is pressed) to right (for browsing to the previous page) and to left (for browsing to the next page). Every page contains 4/6/9 panels with 4/6/9 pictureboxes with some gifs as images.

The issue is that when the user drag with the mouse to browse to a page, the panels and the pictureboxes jerks around when they are moved.

Here is the code that handles the slide part

If i + speed < 1024 Then
For j As Integer = 0 To nrOfGamesInTotal - 1
totemGame.gamePanel(j).Left = totemGame.gamePanel(j).Left + direction * speed

[Code].....

View 1 Replies

Loading Images Into PictureBoxes?

Mar 13, 2009

PicBox(0, 0).Image = My.Resources.ship1
PicBox(0, 1).Image = My.Resources.ship2

View 13 Replies

Save Pictureboxes As A .bin File?

Oct 7, 2010

i want to know if you can save pictureboxes into a bin file and load them in? Here is a basic code i wrote up that did not work. If you tryed and cannot save pictureboxes as a bin file please suggest another way. But if it is xml dont bother to tell me. I went down that path and left. It was to hard and did not work.

Code:

Imports System.IO
Imports System.Collections
Imports System.Runtime.Serialization.Formatters.Binary

[Code].....

View 1 Replies

Set Positions Of Many Pictureboxes Efficiently?

May 23, 2011

I have 20 PictureBoxes named PictureBox2 through to PictureBox 21, where I need to conditionally set the positon of them. I was wondering if there is a more efficient way to set their positions than to copy the code out 20 times. This is what I have so far:

For NextPos As Integer = 2 To 21
Select Case Direction
Case 1

[code]....

View 4 Replies

Use Events Generated By Pictureboxes?

Jun 21, 2009

I made some code:

Dim pictureBoxes(1, 9, 9) As PictureBox
Dim groupBoxes(1) As GroupBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code]...

I don't see controls so I think didn't properly initialized them.. When I look at designer generated code i see:

Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

And I can not implement a for loop outside a method to define all of the groupboxes and pictureboxes, doing it one at a time isn't so smart. Now can I modify my code so i can properly initialize all form controls I am trying or I need to take a totaly different approach? Note that I need to use events generated by pictureboxes.

groupBoxes(table) = New GroupBox
With groupBoxes(table)
.Location = New System.Drawing.Point(15, 30) ' TODO

[code]...

Is there any way to assign a value to object in a With/End With code block or I am forced to use the example before?

Note: VS2005, VB 8, .NET 2.0

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved