473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i create objects at runtime in a picturebox?

13 New Member
I want to create an array of lines when my form loads inside of a picture box, without having to copy-paste on the form. so far, i have created a line on the form and set its index to 0. then, in the code i put

For LinCount = 1 To (somenumber)
Load BoxlinBorder(Li nCount)
Next LinCount

which creates the lines without any errors. I still need to put the lines into a picturebox somehow, and i would like to declare everything in code, not on the form. That is, is there some way to create the line array without having to make a line on the form first? Any help is appreciated.

Thanks,
vfiroiu
May 19 '07
13 3450
Killer42
8,435 Recognized Expert Expert
by the way: what is the purpose of "somename"?
According to the documented parameters, you have to give the new conrtrol a name. I just called it "SomeName". You will probably want to use something more meaningful.
May 24 '07 #11
Killer42
8,435 Recognized Expert Expert
I now get an error when i try to use expressions like MyLine.Count
It isn't terribly important, but i would like to know why and how to fix it, if possible
An array doesn't have a .Count property. You might be getting arrays confused with Collections, which are similar in many ways.

There are functions Lbound() and Ubound() which will tell you the lower and upper limits ("bounds") of an array.

also: i get an error when i try to

for lincount = 1 to somenumber
Load MyLine(lincount )
next lincount
I think you need to be more specific - what error? At what line? If it's inside the loop, how many times does it go 'round the loop before hitting the error?
May 24 '07 #12
vfiroiu
13 New Member
So do Ubound() and Lbound() give the highest and lowest index in the array?

And i think that the

for lincount = 1 to somenumber
load Myline(lincount )
next lincount

doesn't work because I already had

Redim Myline(0 to somenumber)

so the controls (lines) already existed, and i couldn't load what already existed
May 26 '07 #13
Killer42
8,435 Recognized Expert Expert
So do Ubound() and Lbound() give the highest and lowest index in the array?
Yes.

And i think that the

for lincount = 1 to somenumber
load Myline(lincount )
next lincount

doesn't work because I already had

Redim Myline(0 to somenumber)

so the controls (lines) already existed, and i couldn't load what already existed
Yes, I believe you're correct on this. When I put together that sample, I had to give up on using Load. It seems you only need to use Load after creating a control array on the form at design time, to add more to the array. If you create the array in code, then you simply Dim or ReDim it to the size you want.
May 27 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1213
by: Jessard | last post by:
Hi Guys and Girls, Does anybody no how to resize a picturebox control at runtime? When i say resize, i mean the actual edges of the picturebox, ie. being able to drag the edges out just as if you went to the ends of a form, the cursor changes to a double ended arrow and you click and drag it as you want. Any suggestions would be good, Jesse
7
8867
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
0
3166
by: 6tc1 | last post by:
Hi all, I've got a UserControl that contains a few PictureBox objects. If I click on outside of the Picture in the UserControl, the scrolling with the mouse button works - however, no amount of clicking on the PictureBox objects will get that scrolling working. However, after I click on outside of the PictureBox object, then click as many times as I like on the PictureBox the scrolling with the mouse wheel continues to work. I found...
15
26513
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
6
4757
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the size of a thumbnail and set the sizemode to Stretch -- I get one thumbnail. I want to retrieve all the picture files (jpg, bmp) in a directory into an array list and then display this list as thumbnails on my form dynamically. So my question is...
5
2272
by: Paul M | last post by:
Hi I need to create a map for a room (chairs, bed, TV, forniture, etc). All object allready exists like png images. I need to create a map for each room, i mean the user need to create. How can I do this? TIA, Paul
0
1279
by: Victor Reboucas | last post by:
Hi, I'm a VB.Net developer and cannot find a way to create a bipmap from a pointer... My application does video rendering using Windows media encoder (that's out of the content of this message). Using a "DataView" object I can attach a "video viewer" to about every control in a Form, using a "integer reference" to attach the viewer object to the control you want to use as a viewer. Question: is there any way to use the...
1
1339
by: =?Utf-8?B?TWFyaW8=?= | last post by:
hi, i would like to add pictureboxes during runtime, but there should not be a specific variable for each picturebox becouse i don't know how much it will be. so i declared a collection referencing on one var declared as picturebox. it works fine to add the controls this way. now i would like to implement one picturebox click handle for each added picturebox and i have no idea how to do this. Friend WithEvents Device As PictureBox
10
7423
by: eddie tan | last post by:
Hi, I have a picturebox with graphics drawn from different objects. In one object I used Pen P1; P1 = new Pen(Color.Blue, 3); Graphics g = null; g = Graphics.FromImage(image.Image); g.DrawPath(P1, Wirepath);
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.