473,473 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Attaching controls in runtime...

I recently converted to VB Net from VB 6 and having troubles with
adding a PictureBox to the form. I create the picturebox but it
doesn't display on my form. I have tried Controls.Add(pic)
but that doesn't work either. Any Help would be much appreciated :).

here is my code so far

Knight

Function CreateSurface(ByVal frm As Form) As PictureBox
Dim pic As New PictureBox
Dim loc As Point

loc.X = frm.Location.X
loc.Y = frm.Location.Y

pic.Name = "surface"
pic.Location = loc
pic.Left = frm.Left
pic.Top = frm.Top
pic.Width = frm.Width
pic.Height = frm.Width
pic.BackColor = Color.Black
pic.Visible = True
pic.Show()
CreateSurface = pic
End Function

Jan 16 '06 #1
3 2001
this seems to work for me
Dim pic As PictureBox
pic = New PictureBox
Me.SuspendLayout()

pic.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Bla ck)
pic.Size = New System.Drawing.Size(50, 50)
pic.BorderStyle = BorderStyle.Fixed3D
pic.Location = New System.Drawing.Point(60, 60)

Me.Controls.Add(pic)

Me.ResumeLayout()
"Knight" <wa*********@sbcglobal.net> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I recently converted to VB Net from VB 6 and having troubles with
adding a PictureBox to the form. I create the picturebox but it
doesn't display on my form. I have tried Controls.Add(pic)
but that doesn't work either. Any Help would be much appreciated :).

here is my code so far

Knight

Function CreateSurface(ByVal frm As Form) As PictureBox
Dim pic As New PictureBox
Dim loc As Point

loc.X = frm.Location.X
loc.Y = frm.Location.Y

pic.Name = "surface"
pic.Location = loc
pic.Left = frm.Left
pic.Top = frm.Top
pic.Width = frm.Width
pic.Height = frm.Width
pic.BackColor = Color.Black
pic.Visible = True
pic.Show()
CreateSurface = pic
End Function

Jan 16 '06 #2
Thank you very much, I was missing Suspend/Resume

Jan 16 '06 #3
"Knight" <wa*********@sbcglobal.net> schrieb:
Thank you very much, I was missing Suspend/Resume


Mhm... This should not make such a big difference.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jan 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Armando | last post by:
Hey gurus - Access 2000 - I have a form with a series of box controls forming a map of clickable areas, and I want each one to have a label. No problem, just put 'em on, right? But I also want...
1
by: rp | last post by:
Hi, How would I create runtime tabpages with runtime controls(textBoxes,comboBox, checkedListBox), inserting,deleting, and modifing the tabpages whenever I want to in C#? Thanks in advance. rp
1
by: Mark Kamoski | last post by:
Hi-- All of sudden (?) the VS.NET v1 IDE is NOT automatically attaching aspnet_wp.exe as a debugged process. Why? Here is the situation. VS.NET (v1)
1
by: Jim Heavey | last post by:
Hello, I was wondering how I would go about attaching some Java script code to a <asp:EditCommandColumn. If the user presses the "edit" link, then I want to test other controls to see if any...
3
by: Charlie | last post by:
Hi: I would like to attach client side code to an imagebutton that is rendered in a Reapeater control. The client code will simply confirm if users wants to continue with an operation. In this...
2
by: Anand Sagar | last post by:
I have a Panel1 and button1 on my webform. At runtime, I create 2 textboxes. I do it at the Page_Load event. I put the code within the " If Not isPostBack" For the button click event, I will do...
4
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
7
by: Varangian | last post by:
Hello is creating controls at runtime the same as designtime ? will a page be faster if controls are created at designtime rather than at runtime ? If so why ? thanks :)
2
by: ARC | last post by:
(sorry for the re-post, but I thought I would put the winmail.dat where it's visible in the subject...thanks!) Hello all, I have a question that I hope someone can help with. I have an Access...
0
marktang
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,...
0
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...
0
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...
1
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...
0
tracyyun
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...

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.