473,776 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading Controls Programatically

Hi,

I am using C# VS2005 and I am having a problem that I did not notice
before in VS2003.

I have created myUserControl that contains a Panel. The panel is
loaded dynamically with a number of ListViews. The number depends on
the size of the form (therefore the size of the panel which is
anchored to resize when form is resized.

Basically, I load my ListView as:

Panel.SuspendLa yout();

// Loads a number of ListViews depending on Panel size
LoadListViewCon trols(Panel.Siz e);

Panel.ResumeLay out();

I have 2 questions:
1. Should I dispose my dynamically loaded listviews when reloading
panel or resizing it?

2. I have noticed that when I drag another window over my form, the
properties of my ListViews (ForeColor and Font) change to the same
properties of container (my panel). So my ListViews which had
programatically set ForeColor and Font to say Red, Arial will change
to panels properties which are say MS Sans Sarif, Black. (It also
happens when form is maximized on ListViews that were not visible
before maximize).
How to fix this?

Any Help Will Be Appreciated,

_dino_
Jan 16 '06 #1
1 2203
For those interested, I have found out that this is rather an IDE
issue than coding issue. When I run my application from IDE, this
repainting problem occurs, when I run it from compiled .exe, the
problem is gone.

_dino_

On Mon, 16 Jan 2006 18:51:28 GMT, Dino Buljubasic
<di**@noplaceli kehome.com> wrote:
Hi,

I am using C# VS2005 and I am having a problem that I did not notice
before in VS2003.

I have created myUserControl that contains a Panel. The panel is
loaded dynamically with a number of ListViews. The number depends on
the size of the form (therefore the size of the panel which is
anchored to resize when form is resized.

Basically, I load my ListView as:

Panel.SuspendL ayout();

// Loads a number of ListViews depending on Panel size
LoadListViewCo ntrols(Panel.Si ze);

Panel.ResumeLa yout();

I have 2 questions:
1. Should I dispose my dynamically loaded listviews when reloading
panel or resizing it?

2. I have noticed that when I drag another window over my form, the
properties of my ListViews (ForeColor and Font) change to the same
properties of container (my panel). So my ListViews which had
programaticall y set ForeColor and Font to say Red, Arial will change
to panels properties which are say MS Sans Sarif, Black. (It also
happens when form is maximized on ListViews that were not visible
before maximize).
How to fix this?

Any Help Will Be Appreciated,

_dino_


Jan 23 '06 #2

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

Similar topics

5
12238
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate Display). I then set my DataGrid.DataSource = dv; I then load the datatable with my rows, and this is...
3
1626
by: markeboy | last post by:
I am wanting to control when a page is loaded using a separate class to manage when and how it should be loade My current implementation needs to set a property of the page programatically (through a defined interface on the page) I can create an instance of the code behind class (and interface) that the page inherits and implements, however, I have no way of then calling it to load Of course, this was quite possible in VB6, by...
1
3359
by: John Cosmas | last post by:
I've got a page which loads up a different user control into a placeholder control every time a button is clicked on the parent page. I use a statement like Me.plcTabViews.Controls.Add(LoadControl("test.ascx")). There are up to 30 possibilities which are decided by CASE statements and keeps one from loading up onto another. However, I'm running into a unique error... Failed to load viewstate. The control tree into which viewstate is...
0
1514
by: Phl | last post by:
Hi, I am trying to create an webform which loads usercontrols dyanamically. I know exactly what to load for some of these controls but for some, I dont want to load it until the user has press a button. The controls which I know I will need at page init gets their viewstate contents back properly per postback. However I am having a lot of troubles with keeping the contents of usercontrols which are
3
1175
by: M K | last post by:
I have a collection of controls I am using on several pages. I have: 1 Image 2 Labels I want to combine these so that I will also have certain properties available programatically. I want to be able to set a 'photoId' Property, that, when set, will call data from a database, set the Image's src property, and set the Label text.
1
1589
by: Dino Buljubasic | last post by:
Hi, I have created myUserControl that contains a Panel. The panel is loaded dynamically with a number of ListViews. The number depends on the size of the form (therefore the size of the panel which is anchored to resize when form is resized). Basically, I load my ListView as: Panel.SuspendLayout();
1
1843
by: Bob Rock | last post by:
Hello, I'm new to ASP.NET and I've been looking into the topic of dynamically loading (typically accomplished with a LoadControl followed by a MyControl.Controls.Add()) both user controls and asp.net web controls. I searched for articles on the internet and in the end I must say that I'm confused. I read about issues related to: a.. events not firing
3
1465
by: =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?= | last post by:
I've a situation where I'm creating controls programatically. I'm programatically creating table cells and rows. I've got an array of data, and I want to format the data on screen in rows of 4. I get my array, calculate how many complete rows I need. Then for each of the complete rows, I format a cell for the data in that array element. When I've completed a row, I add it to my table. If I have a remainder, I do that at the end. ...
2
7181
by: adiel_g | last post by:
I added a user control to a webform in Asp.net 2.0. I am also adding several other user controls to this webform. Now I am trying to find a way to stop the user controls from loading up when I call the webform. I could possibly have 10 user controls in this page and I would not want all of them to load up. I would like to control which user control loads up. I have tried placing each user control in a separate placeholder and then...
0
9628
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, 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...
0
9464
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
10120
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
10061
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
8952
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
6722
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();...
0
5367
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.