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
13 3442 Dököll 2,364
Recognized Expert Top Contributor - For LinCount = 1 To (somenumber)
-
Load BoxlinBorder(LinCount)
-
Next LinCount
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
Not sure how this would work, vfiroiu, but have you tried doing this in form load?
Yes, the above code is in Form - Activate. By the way, BoxlinBorder() is a line array with only one element (BoxlinBorder(0 ), which i created in the form), I don't think i made that clear.
Yes, the above code is in Form - Activate. By the way, BoxlinBorder() is a line array with only one element (BoxlinBorder(0 ), which i created in the form), I don't think i made that clear.
Have you made any progress on this?
I see the problem. I've loaded arrays of controls like this at runtime myself, but have always done so by creating the "zeroth" element at design time and simply loading more occurrences at runtime. Is there a real need to avoid this, or is it just that you're determined to "beat this thing"? :-)
Anyway, I'll have a play around and see whether I can come up with anything.
Oh, by the way. I think (not sure) that you can place the line control into a picturebox by setting the line's .Container property.
Ok, I've got something for you.
Here's some code which creates a line control at runtime. I've done it as the first element of an array, simply because arrays are so powerful and convenient. But it was all done at runtime. Give it a try, it'll give you a basis to work from. - Option Explicit
-
-
Dim MyLine() As Control
-
-
Private Sub Form_Load()
-
ReDim MyLine(0 To 5)
-
Set MyLine(0) = Form1.Controls.Add("VB.Line", "SomeName", Form1)
-
With MyLine(0)
-
.X1 = 0
-
.X2 = 500
-
.Y1 = 0
-
.Y2 = 500
-
.Visible = True
-
.BorderColor = 0&
-
' To move the line control into picturebox Picture1, do this...
-
' Set .Container = Picture1
-
End With
-
End Sub
hmmm, I've tried the .Container to put the line in the picture box.... but i suppose i had the syntax wrong. I will try this, thanks for the help!
hmmm, I've tried the .Container to put the line in the picture box.... but i suppose i had the syntax wrong. I will try this, thanks for the help!
You probably left out the Set keyword - same mistake I made until I checked the doco.
by the way: what is the purpose of "somename"?
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
also: i get an error when i try to
for lincount = 1 to somenumber
Load MyLine(lincount )
next lincount
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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...
|
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
|
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...
| |
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
|
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...
|
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
|
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);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |