473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Please help me

Hi
I would like to ask 3 questions. I want to display a usercontrol in a form so I create an instance of the control with new(), and then set the location with the Location property and then use add(). No problems so far. Now I would like this picture moving from left to right so I put set the location-property, add(), and sleep(1000) inside a for-loop and increment the coordinates every time, but when I start the program the form doesn't show until the usercontrol has moved to it's end destination. Why is it like that?

I also tried first putting the usercontrol at one location and then change the location property to another coordinate(without a loop), but in this case the usercontrol is only shown at the first location instead of the second, in this experiment I would like the control to show in the second location instead of the first. What have I done wrong in this case

My third question is how do I remove a control that I have shown on a form

Thank you in advance.
Nov 15 '05 #1
2 1078

"lagoon75" <la******@hotmail.com> wrote in message
news:FF**********************************@microsof t.com...
Hi,
I would like to ask 3 questions. I want to display a usercontrol in a form so I create an instance of the control with new(), and then set the location
with the Location property and then use add(). No problems so far. Now I
would like this picture moving from left to right so I put set the
location-property, add(), and sleep(1000) inside a for-loop and increment
the coordinates every time, but when I start the program the form doesn't
show until the usercontrol has moved to it's end destination. Why is it like
that?

The form's thread is so busy performing the looping operation it doesn't
have time to refresh the screen. 2 possible answers.
1. Use a second thread
2. in the loop do an Application.DoEvents (this tells the thread to perform
any pending operations before continuing with the loop). Also, be sure to
invalidate the area of the form that needs to be redrawn so the thread knows
what to re-draw.

I also tried first putting the usercontrol at one location and then change the location property to another coordinate(without a loop), but in this
case the usercontrol is only shown at the first location instead of the
second, in this experiment I would like the control to show in the second
location instead of the first. What have I done wrong in this case?
I would have to see a snippet to give you an answer on this one.
My third question is how do I remove a control that I have shown on a form? this.Controls.Remove(MyControlInstance);
or, if you just want it to not show,
MyControlInstance.Hide();
Thank you in advance.

Nov 15 '05 #2

"lagoon75" <la******@hotmail.com> wrote in message
news:FF**********************************@microsof t.com...
Hi,
I would like to ask 3 questions. I want to display a usercontrol in a form so I create an instance of the control with new(), and then set the location
with the Location property and then use add(). No problems so far. Now I
would like this picture moving from left to right so I put set the
location-property, add(), and sleep(1000) inside a for-loop and increment
the coordinates every time, but when I start the program the form doesn't
show until the usercontrol has moved to it's end destination. Why is it like
that?

The form's thread is so busy performing the looping operation it doesn't
have time to refresh the screen. 2 possible answers.
1. Use a second thread
2. in the loop do an Application.DoEvents (this tells the thread to perform
any pending operations before continuing with the loop). Also, be sure to
invalidate the area of the form that needs to be redrawn so the thread knows
what to re-draw.

I also tried first putting the usercontrol at one location and then change the location property to another coordinate(without a loop), but in this
case the usercontrol is only shown at the first location instead of the
second, in this experiment I would like the control to show in the second
location instead of the first. What have I done wrong in this case?
I would have to see a snippet to give you an answer on this one.
My third question is how do I remove a control that I have shown on a form? this.Controls.Remove(MyControlInstance);
or, if you just want it to not show,
MyControlInstance.Hide();
Thank you in advance.

Nov 15 '05 #3

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

Similar topics

1
by: Numberwhun | last post by:
Hello everyone! I am trying to learn java and have run into kind of a snag. Here is the code that I have so far: ------ <begin_code> ---------- import javax.swing.*; import...
1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
0
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
4
by: fatboySudsy | last post by:
Hi, I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.