|
Firstly: Don't do it!
If you access controls on one form from another, then you are locking the design of teh two forms together - you cannot change one form without changing the other. This defeats one of the intentions of an OOP language at a stroke, and it why by default controls are not declared as public.
Instead, either:
1) Set up a public property or method on form2 which form1 can access to get the information it needs without knowning the internal details of form2.
or
2) Set up an event or delegate with form1 can subscribe to get the information.
Depending on what you are doing when you need the information will determine which way to go. If you need form1 to be aware when the datetimepicker has changed, then use (2), otherwise, go with (1).
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Dear friends,please help me
thanks.
can write an example ?
modified on Friday, January 8, 2010 2:18 AM
|
|
|
|
|
I dnt know what's IE adddress. Maybe you mean IP address? Then the answer is here: [^]
|
|
|
|
|
Thanks for you answer.
Sorry English is hard for me .
IE address=The Address in the browser's address bar.
|
|
|
|
|
|
No, not so far.
|
|
|
|
|
hi, try this:
System.Web.HttpContext.Current.Request.Url
|
|
|
|
|
How do i get the date, burned speed, manufactorer id of cd or dvd that i was burned?
|
|
|
|
|
Hi!
I've got a weird problem.
Console.Beep(int,int) method is supposed to use motherboard's speaker. In my case a sound comes from a sound card. How to get a true beep?
Thanks in advance
Greetings - Jacek
|
|
|
|
|
Some sound cards route the pc speaker to them. I would try to test if that is the case.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
If so, is there any work-around?
Greetings - Jacek
|
|
|
|
|
It is a hardware level thing, so you MIGHT be able to do it with some unmanaged code.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
|
It sounds pretty accurate - I remember the chip, and using it in designs. If you're interested - 8254 Timer Datasheet[^].
My personal favorite was the Signetics 25120[^] Write Only Memory (WOM).
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I am trying to show a small form when you hover over this label. A image is on this form and thats it (form is borderless). When you hover over the label it comes up, when you move the mouse left or right or up or down it moves with it. Problem is it keeps flashing! What am I doing wrong?
private void lbSig_MouseEnter(object sender, EventArgs e)
{
sigForm.Location = new Point(Cursor.Position.X, Cursor.Position.Y);
sigForm.Show();
}
private void lbSig_MouseLeave(object sender, EventArgs e)
{
sigForm.Hide();
}
private void lbSig_MouseMove(object sender, MouseEventArgs e)
{
sigForm.Location = Cursor.Position;
}
|
|
|
|
|
Hi Jacob,
I guess this is what is going on:
mouse enters label, sigForm gets shown at same location, on top of label, hence label fires MouseLeave, formsig gets hidden, hence mouse on top of label again, etc.
suggestion: remove the sigForm.Hide() and choose another way to terminate your magnifying glass or whatever it is you are doing.
|
|
|
|
|
Uhm... not really sure where to go from there on that one...
Let me give an example:
http://home.comcast.net/~littlemoe85/thumbhover/index.html
Now obviously that is for web design but I want the same effect in Windows.
You hover over a label, when you do a image comes up showing the users signature (which is saved in the database). The reason I am doing it in another form rather than drawing it on the current form is because where the label is positioned. The size of the images vary (which explains the popup rather than just resizing the panel or picturebox on the form). Doing it in another form shows it outside that parent form. Which means it can be shown ontop of the parent form and not cut any of the image off because it went to far to the right or whatever...
Any other ideas?
|
|
|
|
|
On the link you provided, I see both a tooltip and an enlarged image when hovering a thumbnail, however they both are NOT located at the hotspot of the cursor, so you never leave the thumbnail. Hence, change your MouseEnter handler to include:
sigForm.Location = new Point(Cursor.Position.X+3, Cursor.Position.Y+3);
or whatever you prefer that keeps sigForm away from the cursor position itself.
|
|
|
|
|
Duh! That makes sense. Since im hovering right where the cursor is it IS firing the MouseLeave. I should of caught that. Thanks for helping me out.. that worked perfect
|
|
|
|
|
And now for the advanced solution: make your sigForm a rectangle with a tiny hole in it, and make it appear so that the cursor points through the hole to the underlying label... That will keep you busy for a while, but I think it is doable (haven't seen it yet though).
|
|
|
|
|
Now that would be difficult... I mean you could make a oval transparent.. but it would still think its on the popup window right?
|
|
|
|
|
not necessarily. You could try and explain the form really isn't a solid rectangle, probably using regions (I haven't ever begun to try it). The easier way would probably be to keep the sigForm disabled, i.e. visible but not available for user interaction.
And then there is an alternative where you don't really put up a new Form, instead you paint things yourself on top of everything that is already on the screen, see e.g. the ControlPaint class; mind you, I haven't been very successful in using it, there seem to be lots of unwanted side effects.
|
|
|
|
|
Hello,
I've developed a client/server application and now I want to send an custom object through TCP/IP.
I've developed a solution for this, that worked, but I'm not shore it is the best. My solution was to convert the object to byte array and then send it to the server; the server convert the byte array to object and this is it!
Does C# have a pattern for this?
Cheer's,
Alex Manolescu.
|
|
|
|
|
What you've described is pretty much it. It's the way that most people would tackle it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks you for replay!
Cheer's,
Alex Manolescu.
|
|
|
|