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
ADVERTISEMENT
Aug 10, 2009
My application has no static number of pictureboxes. I want to add picturebox to array control.
[Code]...
View 4 Replies
Mar 7, 2010
Dim lv As Integer
For lv = 1 To 33
picPileCard(lv.ToString).visible = False
Next
That's the code but its saying the name hasn't been declared.
View 4 Replies
Aug 19, 2009
I have 15 checkboxes of control array and at run time fill any 4 or 5 or 6 check boxes with color using colordialog. How can i send the colors to the sql server table using for loop using code at runtime
View 1 Replies
Jul 5, 2010
I tried using keypress event to set the focus to another control after selecting record from combobox and pressing the enter key but it is not working.
View 2 Replies
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
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
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
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
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
Dec 7, 2011
I have multiple pictureboxes, is there a way to assign the same event and code once for all the pictureboxes ?
View 5 Replies
Feb 16, 2012
I recently posted a problem with a game that I am making, I have worked on it but have become stuck. I am having trouble with creating an object from my class what I need to do is apply this class to multiple picture boxes so that I can have them moving on screen at the same time. I am unsure on whether or not I have set up the class correctly and am unsure on how to apply it to multiple picture boxes.
This is the class:
Public Class enemycar
Inherits PictureBox
Private speed As Integer
Private xposition As New Random
[Code] .....
View 2 Replies
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
May 6, 2012
I create multiple dynamic pictureboxes and it are to many to add them all manually, is there a way I can e.g. use an integer which adds up every time a new picturebox is made. Then I want to add the same code to every picturebox. Now it creates the picturebox and moves it to the next spot and doesn't create a second. I am using this code if its helpfull:
[Code]...
View 9 Replies
Oct 15, 2010
Using the code below I can create multiple pictureboxes dynamically on a form. What I can't figure out how to do is determine when the user selects one by clicking on it. If I use mousedown events I have to hard code in the subroutine the name of the picturebox, which I don't know until the user selects it.
Private
Sub AddNewPictureToolStripMenuItem_Click(ByVal
sender As System.Object,
[Code].....
View 2 Replies
Nov 23, 2010
Is it possible to modify this section of code to select multiple instances of pictureboxes, so that I can drag them all together. At the moment I have to do one at a time, and when there's more than half a dozen, its a bit tedious. I've added the Control key to distinguish it from single drag'n'Drop, but.
'using Left mousebutton and Control to multi drag & drop
e.Button = MouseButtons.Left And My.Computer.Keyboard.CtrlKeyDown Then
newPictureBox = DirectCast(sender, PictureBox)
[code].....
View 2 Replies
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
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
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
Nov 12, 2010
I wonder how you can make a picturebox selectable at runtime and also change the size and location during runtime?
Well I know how i can change the location of a picture box during runtime but that is only with a picturebox that is already defined in the form before runtime.
So I write an event for that particular Picturebox.
But now i want to do the same thing with a picturebox that a user can add during runtime and then the user should be able to select and move the picturebox.
So now i can't add code to the picturebox event so I wonder how you should do this. ( Maybe with reflection?)
And what if the user added 10 picture boxes and selects a certain picturebox. How do you make it possible that the picturebox the user clicks on is selected?
Should you store each picture box location on the Panel and then when the user clicks on a certain pixel in the panel where a certain picture box is it get's selected?
View 3 Replies
Dec 19, 2011
I have this code. credits to jmchiney. My goal is when I press a certain key, the picturebox corresponding to that key should be moved to a certain location. Exactly like in the text twist game.
I have a code running and doing what I want but It is only applicable for single letter. For example the word alabama. all letters without duplicates are placed properly but for letter a, only one letter a is being accepted and moved. that goes for all letters.
Here is the
Dim pb As New PictureBox
Select Case (e.KeyChar)
Case CChar(letterPicbox1.Tag)
[Code].....
Another one. when a certain letter is already placed to the location I set and once I press again the same letter, the location changes. What I want is when I already gave pictureboxA a location and then I press "a" which correspond to pictureboxA again it should be stationary and check if there are other letter "a" in my pictureboxes and move the next detected letter "a" to the next position. Like i said. just like text twist game.
View 1 Replies
Jun 18, 2012
I've tried following the Microsoft instructions to add multiple Textboxes to my form, but just cannot get it to work.Thus, I've deleted everything I wrote, so I don't have code to post. Is there a very simple way to add multiple TextBoxes to a form and be able to index them? If it's too lengthy, Is there a workaround?
View 6 Replies
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
Nov 6, 2008
I have created a set of scrollbars in a loop like this:
for i = 0 to 18
Dim scrolldmx As New VScrollBar
scrolldmx.Location = New System.Drawing.Point(x, y)
[CODE]...
And I have a handler to handle the scroll event. All good. I want to be able to set the value of them within the app. I can set the width of for instance the second scroll bar like this: me.controls("scroll" & 1).width = 100
But I can't see how to set it's value. I want to be able to "lock" several scroll bars together to make them all follow the value of the one I am changing.
View 2 Replies
Apr 22, 2007
OK as far as I know there is no control array in Visual Basic 2005 So how do I do this. I want to change the color of an array of pictureboxes some red some green almost like sending an SOS message. So I already have a string of ones and zero's like 11000110001001100011......these are already in an integer array........ARRAY(40) ......but now I need to transfer this data to an array of pictureBoxes by turning them Red or Green to show the message. I just wanted to place the integer array and the PictureBox array in the same.......
[Code]...
View 6 Replies
Dec 24, 2010
I am developing an application with multiple picture boxes, each displaying a line graph. I want to be able to have a label following the mousepointer showing xy coordinates of the point. I also want to allow a user to zoom in on a specific picture box by double clicking on it. The code does what I want as written (changes backcolor so I know double click event fires) except moving the position of the label to follow the mouse pointer.
However if if uncomment the line in the MouseMoved sub:
LB.Location = New Point(e.X, e.Y)
Then the label moves as desired however the double click event no longer fires.
Public Class Form1
Dim PB As New PictureBox, LB As New Label
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Controls.Add(PB)
With PB
[Code] .....
View 2 Replies
May 13, 2011
Okay, so I have some problems with dynamically added pictureboxes. This is the code I have now. When I click on one of the imageboxes, I get teh following error: Index was outside the bounds of the array.
[Code]...
View 2 Replies
Nov 23, 2009
I only started using visual basic earlier this year so I'm still a newbie but I've been wondering some things:
1. When you have a picturebox back color to transparent, objects under it still get hidden. Is there a way around this?
2. I've been trying to make a program where you can control an object, and it has multiple animations, but I can't figure out a way of doing this other than having a bunch of picture boxes together and making them visible/not visible as needed. Is there a better way to do this?
3. (I think) I know how to make global variables (dim whatever as global.system.integer ? I don't have it on the computer I'm posting with), but how do I make another form use them?
4. Is there a way to have multiple sounds play at the same time? Whenever I play a sound it stops whatever else is playing.
View 7 Replies
Nov 10, 2009
initialize an indefinite (eg. Decimal) array without setting boundaries on the array length?
View 2 Replies
Jul 23, 2011
I am looking how to set events to a webrowser which is being created by the following:
[Code]...
View 1 Replies